Skip to content

florin-rotaru/Statics.Compare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);