SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method ToLookup

    ToLookup<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>>)

    Creates an ILookup<TKey, TElement> from a sequence of KeyValuePair<TKey, TValue> elements.

    Declaration
    public static ILookup<TKey, TValue> ToLookup<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source)
    Parameters
    Type Name Description
    IEnumerable<KeyValuePair<TKey, TValue>> source

    The source sequence of key-value pairs.

    Returns
    Type Description
    ILookup<TKey, TValue>

    An ILookup<TKey, TElement> containing the values mapped to their keys.

    Type Parameters
    Name Description
    TKey

    The type of the key.

    TValue

    The type of the value.

    Remarks

    This method executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null

    ToLookup<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>>, IEqualityComparer<TKey>?)

    Creates an ILookup<TKey, TElement> from a sequence of KeyValuePair<TKey, TValue> elements. An additional parameter specifies a comparer for keys.

    Declaration
    public static ILookup<TKey, TValue> ToLookup<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey>? comparer)
    Parameters
    Type Name Description
    IEnumerable<KeyValuePair<TKey, TValue>> source

    The source sequence of key-value pairs.

    IEqualityComparer<TKey> comparer

    The comparer for keys.

    Returns
    Type Description
    ILookup<TKey, TValue>

    An ILookup<TKey, TElement> containing the values mapped to their keys.

    Type Parameters
    Name Description
    TKey

    The type of the key.

    TValue

    The type of the value.

    Remarks

    This method executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null

    ToLookup<TKey, TValue>(IEnumerable<(TKey Key, TValue Value)>)

    Creates an ILookup<TKey, TElement> /> from a sequence of tuples of 2 where the first item is the key and the second the value.

    Declaration
    public static ILookup<TKey, TValue> ToLookup<TKey, TValue>(this IEnumerable<(TKey Key, TValue Value)> source)
    Parameters
    Type Name Description
    IEnumerable<(TKey Key, TValue Value)> source

    The source sequence of tuples of 2.

    Returns
    Type Description
    ILookup<TKey, TValue>

    An ILookup<TKey, TElement> containing the values mapped to their keys.

    Type Parameters
    Name Description
    TKey

    The type of the key.

    TValue

    The type of the value.

    Remarks

    This method executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null

    ToLookup<TKey, TValue>(IEnumerable<(TKey Key, TValue Value)>, IEqualityComparer<TKey>?)

    Creates an ILookup<TKey, TElement> from a sequence of tuples of 2 where the first item is the key and the second the value. An additional parameter specifies a comparer for keys.

    Declaration
    public static ILookup<TKey, TValue> ToLookup<TKey, TValue>(this IEnumerable<(TKey Key, TValue Value)> source, IEqualityComparer<TKey>? comparer)
    Parameters
    Type Name Description
    IEnumerable<(TKey Key, TValue Value)> source

    The source sequence of tuples of 2.

    IEqualityComparer<TKey> comparer

    The comparer for keys.

    Returns
    Type Description
    ILookup<TKey, TValue>

    An ILookup<TKey, TElement> containing the values mapped to their keys.

    Type Parameters
    Name Description
    TKey

    The type of the key.

    TValue

    The type of the value.

    Remarks

    This method executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null

    © SuperLinq Authors. All rights reserved.