Class IEqualityComparerExtensions
Extension methods that compare collections element-wise with an IEqualityComparer<T> or IValueEqualityComparer<T>.
public static class IEqualityComparerExtensions
- Inheritance
-
IEqualityComparerExtensions
- Inherited Members
Methods
Equals<T>(IEqualityComparer<T>, IReadOnlyList<T>?, IReadOnlyList<T>?)
Determines whether two lists contain the same elements, using the comparer.
public static bool Equals<T>(this IEqualityComparer<T> comparer, IReadOnlyList<T>? x, IReadOnlyList<T>? y)
Parameters
comparerIEqualityComparer<T>The element comparer.
xIReadOnlyList<T>The first list, or
null.yIReadOnlyList<T>The second list, or
null.
Returns
- bool
truewhen both arenull, or both have equal count and equal elements.
Type Parameters
TThe element type.
Equals<T>(IEqualityComparer<T>, T[]?, T[]?)
Determines whether two arrays contain the same elements, using the comparer.
public static bool Equals<T>(this IEqualityComparer<T> comparer, T[]? x, T[]? y) where T : class
Parameters
comparerIEqualityComparer<T>The element comparer.
xT[]The first array, or
null.yT[]The second array, or
null.
Returns
- bool
truewhen both arenull, or both have equal length and equal elements.
Type Parameters
TThe element type.
ValueEquals<T>(IValueEqualityComparer<T>, T[]?, T[]?)
Determines whether two arrays contain the same value elements, using the by-reference comparer.
public static bool ValueEquals<T>(this IValueEqualityComparer<T> comparer, T[]? x, T[]? y) where T : struct
Parameters
comparerIValueEqualityComparer<T>The value comparer.
xT[]The first array, or
null.yT[]The second array, or
null.
Returns
- bool
truewhen both arenull, or both have equal length and equal elements.
Type Parameters
TThe element type.