Skip to content

Comparison Options

Michael Brown edited this page Apr 22, 2020 · 3 revisions

Different options can be passed when computing a diff of two objects.

Comparison Options

CompareProperties

Compare properties of an object

CompareFields

Compare field members of an object

CompareCollections

Comparing of contents of collections such as Arrays, Lists, Dictionaries

All (default)

This is a equivalent to CompareProperties | CompareFields | CompareCollections and is the default value.

DisableIgnoreAttributes

A special flag to turn off checks for supported Ignore attributes

ExcludeList

The property expressions you pass will be treated as an exclusion/ignore list (default)

IncludeList

The property expressions/names you pass will be treated as an inclusion list, and will only compare properties that you have indicated. This overrides the default behavior of ExcludeList.

AllowCollectionsToBeOutOfOrder

A flag that allows you to compare collections that may be out of order. Any values not in both collections, or a different number of values and occurrences will appear as a difference. You should also use AllowEqualsOverride when using this option as this is usually required to function.

AllowEqualsOverride

A flag that allows you to include IEquatable comparisons, custom Equals overrides, and custom equality operators when checking for object equality.

AllowCompareDifferentObjects

A special flag to allow comparing of two differently typed objects with similar property names. Any properties/fields that are a different type or name will show up as differences. See Comparing Differently Typed Objects

IncludeListNoInheritance

Specify the IncludeList should not inherit children unless specified

TreatEmptyListAndNullTheSame

Specify that an empty list and a null list would be an equal comparison