Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: Dictionary<TKey1, Dictionary<TKey2, TSource>> ToDictionary2<TSource, TKey1, TKey2>(this IEnumerable<TSource>, Func<TSource, TKey1>, Func<TSource, TKey2>, IEqualityComparer<TKey1>, IEqualityComparer<TKey2>)

Declaration

public static Dictionary<TKey1, Dictionary<TKey2, TSource>> ToDictionary2<TSource, TKey1, TKey2>(
    this IEnumerable<TSource> source,
    Func<TSource, TKey1> key1Selector,
    Func<TSource, TKey2> key2Selector,
    IEqualityComparer<TKey1> comparer1 = null,
    IEqualityComparer<TKey2> comparer2 = null
)

Summary

Creates a two-level dictionary from an enumerable collection according to two specified key selector functions and optional key comparers.

Generic type parameters

TSource The type of the elements of source.
TKey1 The type of the keys returned by key1Selector.
TKey2 The type of the keys returned by key2Selector.

Parameters

this IEnumerable<TSource>source Source collection to create a dictionary from.
Func<TSource, TKey1>key1Selector A function to extract the first-level key from each element.
Func<TSource, TKey2>key2Selector A function to extract the second-level key from each element.
IEqualityComparer<TKey1>comparer1 An equality comparer to compare the first-level keys.
IEqualityComparer<TKey2>comparer2 An equality comparer to compare the second-level keys.