Class IEnumerableExtensions
Inheritance
IEnumerableExtensions
Assembly: Estrelica.Utility.dll
Syntax
[DoNotObfuscateType]
public static class IEnumerableExtensions
Methods
Declaration
public static IEnumerable<T> Distinct<T, K>(this IEnumerable<T> source, Func<T, K> idCallback)
Parameters
Returns
Type Parameters
Compares two enumerable sequences and returns true if their contents match.
Declaration
public static bool Matches<T>(this IEnumerable<T> source, IEnumerable<T> target, bool anyOrder = true, bool ignoreDuplicates = true, bool treatNullAsEmptySet = true)
Parameters
IEnumerable<T>
source
The source enumerable to compare
|
IEnumerable<T>
target
The target enumerable to compare
|
bool
anyOrder
If true, the two sets will be considered a match as long as they both contain the same items, regardless of what order the items are in. If false,
the items must appear in the same order in both sets. Defaults to true (e.g. { 1, 2, 3 } matches { 3, 2, 1}).
|
bool
ignoreDuplicates
If true, the two sets will be considered a match regardless of any duplicates in one or both sets. If false, any duplicates in one set
must also be duplicated in the other set. Defaults to true (e.g. { 1, 2, 2, 3} matches { 1, 2, 3}).
|
bool
treatNullAsEmptySet
If true (the default), a null enumerable will be considered equivalent to T[]{}. E.g. source = null and target = {} would be considered a match. If false, null will not be considered a match for anything but null.
|
Returns
bool
True if the sequences match per the above rules, false if not
|
Type Parameters
Helper method for unit tests and other cases where a single item needs to be considered as the sole member of an IEnumerable.
Declaration
public static IEnumerable<T> ToEnumerable<T>(this T item)
Parameters
Returns
Type Parameters