-
Notifications
You must be signed in to change notification settings - Fork 15
Diff.CalculateSections Method
This method calculates what is known as a "diff section", a portion of the two collections that either is similar or is not. A section can encompass from zero to N elements on both sides. At least one side will have elements.
Method signature:
public static IEnumerable<DiffSection> CalculateSections<T>(
IList<T> collection1,
IList<T> collection2,
IEqualityComparer<T> comparer = null)
The method takes the following parameters, in signature order:
-
IList<T> collection1This specifies one of the two collections that will be compared.
Note the type, to signal that the diff engine needs fast random access to the collection,
IList<T>is used instead of the customaryIEnumerable<T>of most similar implementations.This parameter cannot be
nullor aArgumentNullExceptionwill be thrown. -
IList<T> collection2This specifies the other of the two collections that will be compared.
Note the type, to signal that the diff engine needs fast random access to the collection,
IList<T>is used instead of the customaryIEnumerable<T>of most similar implementations.This parameter cannot be
nullor aArgumentNullExceptionwill be thrown. -
IEqualityComparer<T> comparerThis optional parameter specifies an
IEqualityComparer<T>implementation that knows how to compare two elements of typeT.If none is provided (pass
null, which is also the default value), thenEqualityComparer<T>.Defaultwill be used.
It returns:
IEnumerable<DiffSection>