-
Notifications
You must be signed in to change notification settings - Fork 18
Diff Only Specified Properties
Michael Brown edited this page Apr 22, 2020
·
5 revisions
AnyDiff also supports processing of specific properties if you don't want to diff the entire object. This works using the same syntax as ignoring properties but passing the IncludeList
ComparisonOptions flag. In the example below, only the properties Id
and Name
will be compared.
If you wish to ignore specified properties, please see Ignore Property/Field
var object1 = new MyComplexObject(1, "A string", true);
var object2 = new MyComplexObject(2, "A different string", true);
var diff = object1.Diff(object2, ComparisonOptions.All | ComparisonOptions.IncludeList, x => x.Id, x => x.Name);
Assert.AreEqual(diff.Count, 0);