Method ToComparerEquatableArray
ToComparerEquatableArray<T>(ImmutableArray<T>, IEqualityComparer<T>?)
Returns a ComparerEquatableArray<T> containing the specified items that uses the specified comparer, or the default comparer if null is specified.
Declaration
public static ComparerEquatableArray<T> ToComparerEquatableArray<T>(this ImmutableArray<T> value, IEqualityComparer<T>? comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ImmutableArray<T> | value | |
| IEqualityComparer<T> | comparer |
Returns
| Type | Description |
|---|---|
| ComparerEquatableArray<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
The values in the array are assumed to be immutable and interchangeable. Equal values must stay equal and keep the same hash code indefinitely, and a value read from the array is only guaranteed to be equal to the one that was passed in, not to be the same instance.
Comparers are compared by reference when determining whether two arrays are equal, with null treated as equivalent to Default.
ToComparerEquatableArray<T>(IEnumerable<T>, IEqualityComparer<T>?)
Returns a ComparerEquatableArray<T> containing the specified items that uses the specified comparer, or the default comparer if null is specified.
Declaration
public static ComparerEquatableArray<T> ToComparerEquatableArray<T>(this IEnumerable<T> value, IEqualityComparer<T>? comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<T> | value | |
| IEqualityComparer<T> | comparer |
Returns
| Type | Description |
|---|---|
| ComparerEquatableArray<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
The values in the array are assumed to be immutable and interchangeable. Equal values must stay equal and keep the same hash code indefinitely, and a value read from the array is only guaranteed to be equal to the one that was passed in, not to be the same instance.
Comparers are compared by reference when determining whether two arrays are equal, with null treated as equivalent to Default.
ToComparerEquatableArray<T>(ReadOnlySpan<T>, IEqualityComparer<T>?)
Returns a ComparerEquatableArray<T> containing the specified items that uses the specified comparer, or the default comparer if null is specified.
Declaration
public static ComparerEquatableArray<T> ToComparerEquatableArray<T>(this ReadOnlySpan<T> value, IEqualityComparer<T>? comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | value | |
| IEqualityComparer<T> | comparer |
Returns
| Type | Description |
|---|---|
| ComparerEquatableArray<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
The values in the array are assumed to be immutable and interchangeable. Equal values must stay equal and keep the same hash code indefinitely, and a value read from the array is only guaranteed to be equal to the one that was passed in, not to be the same instance.
Comparers are compared by reference when determining whether two arrays are equal, with null treated as equivalent to Default.
ToComparerEquatableArray<T>(T[], IEqualityComparer<T>?)
Returns a ComparerEquatableArray<T> containing the specified items that uses the specified comparer, or the default comparer if null is specified.
Declaration
public static ComparerEquatableArray<T> ToComparerEquatableArray<T>(this T[] value, IEqualityComparer<T>? comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | value | |
| IEqualityComparer<T> | comparer |
Returns
| Type | Description |
|---|---|
| ComparerEquatableArray<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
The values in the array are assumed to be immutable and interchangeable. Equal values must stay equal and keep the same hash code indefinitely, and a value read from the array is only guaranteed to be equal to the one that was passed in, not to be the same instance.
Comparers are compared by reference when determining whether two arrays are equal, with null treated as equivalent to Default.