ObjectDiff
ConsoleMonster.Changes
Compares objects and collections: objects are matched by key, then compared property by property (nested objects by path), giving added, removed and changed objects with counts. Show the result with ChangeView or ask before acting with ChangePreview.
Inheritance
- object
- ObjectDiff
Methods
public static ChangeSet Compare(object? before, object? after, DiffOptions? options = null) #Compares two values: two collections item by item (matched by key), anything else as one object.
Parameters
- before object?
- The old value.
- after object?
- The new value.
- options ConsoleMonster.Changes.DiffOptions? = null
- Options, or null.
public static ChangeSet Compare(IEnumerable<object?> before, IEnumerable<object?> after, DiffOptions? options = null) #Compares two collections: items are matched by key and compared property by property.
Parameters
- before System.Collections.Generic.IEnumerable<object?>
- The old items.
- after System.Collections.Generic.IEnumerable<object?>
- The new items.
- options ConsoleMonster.Changes.DiffOptions? = null
- Options, or null.
public static BaselineComparison CompareBaseline(IEnumerable<object?> objects, DiffOptions? options = null, IReadOnlyList<string>? names = null) #Compares two or more objects as property rows against a reference column.
Parameters
- objects System.Collections.Generic.IEnumerable<object?>
- Objects in column order; null represents an object with no properties.
- options ConsoleMonster.Changes.DiffOptions? = null
- Shared path, depth, normalization, equality and baseline selection options.
- names System.Collections.Generic.IReadOnlyList<string>? = null
- Explicit column names, or null to use the key selector and default key properties.
public static IReadOnlyList<PropertyChange> CompareObjects(object? before, object? after, DiffOptions? options = null) #The changed properties of two objects (nested objects by path, up to DiffOptions.Depth).
Parameters
- before object?
- The old object.
- after object?
- The new object.
- options ConsoleMonster.Changes.DiffOptions? = null
- Options, or null.
public static string PairText(object? value, object? other) #A value as display text next to the value it is compared with: when two different dates would read the same (they differ below a minute), the seconds are shown, so a change never looks like no change.
Parameters
- value object?
- The value.
- other object?
- The value on the other side.
Returns
string The text.public static string Text(object? value) #A value as display text: null as empty, collections as {a, b}.
Parameters
- value object?
- The value.
Returns
string The text.