Diff<>(old, new, comparer, predicate, postProcessor) NewArray<>(size1, size2, size3, initialiser) RunMain(main, onUnhandledMain, onUnhandledThread) RunMain(main, onUnhandledMain, onUnhandledThread)
Legend Class Struct Enum Interface Delegate | Constructor Method Property Event Field |
| Static method: IEnumerable<ValueTuple<T, DiffOp>> Diff<T>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>, Func<T, bool>, Func<IEnumerable<T>, IEnumerable<T>, IEnumerable<ValueTuple<T, DiffOp>>>)Declarationpublic static IEnumerable<ValueTuple<T, DiffOp>> Diff<T>(
IEnumerable<T> old,
IEnumerable<T> new,
IEqualityComparer<T> comparer = null,
Func<T, bool> predicate = null,
Func<IEnumerable<T>, IEnumerable<T>, IEnumerable<ValueTuple<T, DiffOp>>> postProcessor = null
) Summary
Computes a representation of the differences between old and new using
the specified options. Generic type parametersT |
The type of items to compare. |
ParametersIEnumerable<T> | old |
The first sequence of elements. Elements only in this sequence are considered "deleted". | IEnumerable<T> | new |
The second sequence of elements. Elements only in this sequence are considered "inserted". | IEqualityComparer<T> | comparer |
The equality comparer to use to compare items in the two sequences, or null to use the default comparer. | Func<T, bool> | predicate |
If not null, determines which elements are "hard matches" (true) and which are "soft matches" (false). A "hard
match" element is one that can always be matched. A "soft match" element is only matched if it is adjacent to
a hard match. | Func<IEnumerable<T>, IEnumerable<T>, IEnumerable<ValueTuple<T, DiffOp>>> | postProcessor |
If not null, provides a post-processing step for parts of the diff in between consecutive matches. Without a
post-processing step, or when the post-processor returns null, these parts are returned as a sequence of
deletes followed by a sequence of inserts. |
Returns
An IEnumerable<Tuple<T, DiffOp>> representing the differences between old and new. Each element in the returned IEnumerable<Tuple<T,
DiffOp>> corresponds either to an element present only in old (the element is
considered “deleted”), an element present only in new (the element is considered
“inserted”) or an element present in both. |