ToLookupManyToMany<TSource, TKey, TElement>(IEnumerable<TSource>, Func<TSource, IEnumerable<TKey>>, Func<TSource, IEnumerable<TElement>>, IEqualityComparer<TKey>) Method
Creates a lookup from a sequence according to a specified key selector function that returns a sequence of keys. The keys are compared by using a comparer and each group's elements are projected by using a specified function that returns a sequence of elements.
Containing Type


public static ILookup<TKey, TElement> ToLookupManyToMany<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TKey>> keySelector, Func<TSource, IEnumerable<TElement>> elementSelector, IEqualityComparer<TKey> comparer)

Type Parameters

Name Description
TSource The type of the source.
TKey The type of the key.
TElement The type of the element.


Name Type Description
source IEnumerable<TSource> The source.
keySelector Func<TSource, IEnumerable<TKey>> The key selector.
elementSelector Func<TSource, IEnumerable<TElement>> The element selector.
comparer IEqualityComparer<TKey> The comparer.

Return Value

Type Description
ILookup<TKey, TElement> A lookup.