SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method LastIndexOf

    LastIndexOf<TSource>(IAsyncEnumerable<TSource>, TSource, CancellationToken)

    Searches for the specified object and returns the zero-based index of the last occurrence within the entire IAsyncEnumerable<T>.

    Declaration
    public static ValueTask<int> LastIndexOf<TSource>(this IAsyncEnumerable<TSource> source, TSource item, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    The source sequence.

    TSource item

    The object to locate in the IAsyncEnumerable<T>. The value can be null for reference types.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<int>

    The zero-based index of the last occurrence of item within the entire IAsyncEnumerable<T>, if found; otherwise, -1.

    Type Parameters
    Name Description
    TSource

    The type of elements of source

    Remarks

    The IAsyncEnumerable<T> is searched forward starting at the first element and ending at the last element, and the index of the last instance of item is returned.

    This method determines equality using the default equality comparer Default for TSource, the type of values in the list.

    This operator executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    LastIndexOf<TSource>(IAsyncEnumerable<TSource>, TSource, Index, CancellationToken)

    Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the IAsyncEnumerable<T> that extends backwards from the specified index to the first element.

    Declaration
    public static ValueTask<int> LastIndexOf<TSource>(this IAsyncEnumerable<TSource> source, TSource item, Index index, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    The source sequence.

    TSource item

    The object to locate in the IAsyncEnumerable<T>. The value can be null for reference types.

    Index index

    The Index of the ending element within the sequence.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<int>

    The zero-based index of the last occurrence of item within the the range of elements in the IAsyncEnumerable<T> that extends backwards from index to the first element, if found; otherwise, -1.

    Type Parameters
    Name Description
    TSource

    The type of elements of source

    Remarks

    The IAsyncEnumerable<T> is searched forward starting at the first element and ending at index, and the index of the last instance of item is returned.

    This method determines equality using the default equality comparer Default for TSource, the type of values in the list.

    This operator executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentOutOfRangeException

    index is less than 0.

    LastIndexOf<TSource>(IAsyncEnumerable<TSource>, TSource, Index, int, CancellationToken)

    Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the IAsyncEnumerable<T> that ends at the specified index to the last element and contains the specified number of elements.

    Declaration
    public static ValueTask<int> LastIndexOf<TSource>(this IAsyncEnumerable<TSource> source, TSource item, Index index, int count, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    The source sequence.

    TSource item

    The object to locate in the IAsyncEnumerable<T>. The value can be null for reference types.

    Index index

    The Index of the ending element within the sequence.

    int count

    The number of elements in the section to search.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<int>

    The zero-based index of the last occurrence of item within the the range of elements in the IAsyncEnumerable<T> that that ends at index and contains count number of elements, if found; otherwise, -1.

    Type Parameters
    Name Description
    TSource

    The type of elements of source

    Remarks

    The IAsyncEnumerable<T> is searched forward starting at the first element and ending at index, and the index of the last instance of item no earlier in the sequence than count items before index is returned.

    This method determines equality using the default equality comparer Default for TSource, the type of values in the list.

    This operator executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentOutOfRangeException

    count is less than 0.

    © SuperLinq Authors. All rights reserved.