florin-rotaru / Statics.Compare

Simple open source objects compare library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is Statics.Compare?

Is a simple open source objects compare library

Overview

Compares members of two objects and evaluates if they are equal or none equal based on conventions (public properties with the same names and same/derived/convertible types). Provides also few tweak options

You can install it via package manager console

PM> Install-Package Statics.Compare

Basic usage

using static Statics.Compare.Members;

var equals = CompareEquals(left, right);

Default compare options

  • StringComparison memberNameComparison = StringComparison.OrdinalIgnoreCase,
  • bool evaluateChildNodes = false,
  • bool ignoreDefaultLeftValues = false,
  • bool ignoreDefaultRightValues = false,
  • bool useConvert = false

Differences can be listed by using parameter memberDiffs:

var equals = CompareEquals(
  leftEntries, 
  rightEntries, 
  out IEnumerable<MemberDiff> memberDiffs, 
  evaluateChildNodes: true);

About

Simple open source objects compare library

License:MIT License


Languages

Language:C# 100.0%