Collections Collections
Collections Collections
DocFX + Singulink = ♥

Search Results for

    Class ComparerEquatableArray<T>

    Represents an immutable array with value-based equality semantics that uses a custom comparer.

    Inheritance
    object
    ComparerEquatableArray<T>
    Implements
    IReadOnlyList<T>
    IReadOnlyCollection<T>
    IList<T>
    ICollection<T>
    IEnumerable<T>
    IEnumerable
    IEquatable<ComparerEquatableArray<T>>
    IFormattable
    Namespace: Singulink.Collections
    Assembly: Singulink.Collections.dll
    Syntax
    public sealed class ComparerEquatableArray<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IEquatable<ComparerEquatableArray<T>>, IFormattable
    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.

    Constructors

    Name Description
    ComparerEquatableArray(ImmutableArray<T>, IEqualityComparer<T>?)

    Initializes a new instance of the ComparerEquatableArray<T> class that wraps the specified immutable array and uses the specified comparer, or the default comparer if null is specified.

    Properties

    Name Description
    Comparer

    Gets the comparer used for value-based equality.

    Empty

    Gets the shared empty instance of the ComparerEquatableArray<T> class with the default comparer.

    IsEmpty

    Gets a value indicating whether the array is empty.

    this[int]

    Gets the element at the specified index in the equatable array.

    Length

    Gets the number of elements in the array.

    UnderlyingArray

    Gets the underlying immutable array (note: the underlying array is not guaranteed to be the same instance, nor the values have the same instance or bits as what was originally passed in).

    Methods

    Name Description
    AsMemory()

    Creates a new read-only memory region over this equatable array.

    AsSpan()

    Creates a new read-only span over this equatable array.

    AsSpan(int, int)

    Creates a new read-only span over the specified portion of this equatable array.

    AsSpan(Range)

    Creates a new read-only span over the specified range of this equatable array.

    Contains(T)

    Determines whether the equatable array contains the specified item.

    Contains(T, IEqualityComparer<T>?)

    Determines whether the equatable array contains the specified item.

    CopyTo(int, T[], int, int)

    Copies a range of elements of the equatable array to the specified destination array.

    CopyTo(Span<T>)

    Copies the elements of the equatable array to the specified destination span.

    CopyTo(T[])

    Copies the elements of the equatable array to the specified destination array.

    CopyTo(T[], int)

    Copies the elements of the equatable array to the specified destination array starting at the specified index of the destination.

    Equals(ComparerEquatableArray<T>?)

    Determines whether the specified object is equal to the current object.

    Equals(object?)

    Determines whether the specified object is equal to the current object.

    GetEnumerator()

    Gets an enumerator for the equatable array.

    GetHashCode()

    Gets a hash code for the equatable array, which is based on value equality, and is cached.

    IndexOf(T)

    Returns the first index of the specified item in the equatable array, or -1 if not found.

    IndexOf(T, IEqualityComparer<T>?)

    Returns the first index of the specified item in the equatable array, or -1 if not found.

    IndexOf(T, int)

    Returns the first index of the specified item in the equatable array, or -1 if not found.

    IndexOf(T, int, IEqualityComparer<T>?)

    Returns the first index of the specified item in the equatable array, or -1 if not found.

    IndexOf(T, int, int)

    Returns the first index of the specified item in the equatable array, or -1 if not found.

    IndexOf(T, int, int, IEqualityComparer<T>?)

    Returns the first index of the specified item in the equatable array, or -1 if not found.

    LastIndexOf(T)

    Returns the last index of the specified item in the equatable array, or -1 if not found.

    LastIndexOf(T, IEqualityComparer<T>?)

    Returns the last index of the specified item in the equatable array, or -1 if not found.

    LastIndexOf(T, int)

    Returns the last index of the specified item in the equatable array, or -1 if not found.

    LastIndexOf(T, int, IEqualityComparer<T>?)

    Returns the last index of the specified item in the equatable array, or -1 if not found.

    LastIndexOf(T, int, int)

    Returns the last index of the specified item in the equatable array, or -1 if not found.

    LastIndexOf(T, int, int, IEqualityComparer<T>?)

    Returns the last index of the specified item in the equatable array, or -1 if not found.

    Slice(int, int)

    Creates a slice of the equatable array from the specified start index with the specified length.

    ToString()

    Returns a string that represents the current object.

    ToString(IFormatProvider?)

    Returns a string representation of the array using the specified format provider to format its elements.

    ToString(string?)

    Returns a string representation of the array using the specified format to format its elements.

    ToString(string?, IFormatProvider?)

    Returns a string representation of the array using the specified format and format provider to format its elements.

    WithComparer(IEqualityComparer<T>?)

    Returns a ComparerEquatableArray<T> instance with the specified comparer over the current values.

    Operators

    Name Description
    operator ==(ComparerEquatableArray<T>?, ComparerEquatableArray<T>?)

    Determines whether two arrays are equal.

    operator !=(ComparerEquatableArray<T>?, ComparerEquatableArray<T>?)

    Determines whether two arrays are not equal.

    Explicit Interface Implementations

    Name Description
    ICollection<T>.Add(T)

    Adds an item to the ICollection<T>.

    ICollection<T>.Clear()

    Removes all items from the ICollection<T>.

    ICollection<T>.CopyTo(T[], int)

    Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

    ICollection<T>.Count

    Gets the number of elements contained in the ICollection<T>.

    ICollection<T>.IsReadOnly

    Gets a value indicating whether the ICollection<T> is read-only.

    ICollection<T>.Remove(T)

    Removes the first occurrence of a specific object from the ICollection<T>.

    IEnumerable<T>.GetEnumerator()

    Returns an enumerator that iterates through the collection.

    IList<T>.Insert(int, T)

    Inserts an item to the IList<T> at the specified index.

    IList<T>.this[int]

    Gets or sets the element at the specified index.

    IList<T>.RemoveAt(int)

    Removes the IList<T> item at the specified index.

    IReadOnlyCollection<T>.Count

    Gets the number of elements in the collection.

    IReadOnlyList<T>.this[int]

    Gets the element at the specified index in the read-only list.

    IEnumerable.GetEnumerator()

    Returns an enumerator that iterates through a collection.

    IFormattable.ToString(string?, IFormatProvider?)

    Formats the value of the current instance using the specified format.

    Extension Methods

    CollectionExtensions.ToComparerEquatableArray<T>(IEnumerable<T>, IEqualityComparer<T>?)
    CollectionExtensions.ToEquatableArray<T>(IEnumerable<T>)
    © Singulink. All rights reserved.