Summary
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function
that returns a sequence of elements.
Syntax
public static IEnumerable<IGrouping<TKey, TElement>> GroupByManyToMany<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TKey>> keySelector, Func<TSource, IEnumerable<TElement>> elementSelector)
Type Parameters
Name |
Description |
TSource |
The type of the source. |
TKey |
The type of the key. |
TElement |
The type of the element. |
Parameters
Name |
Type |
Description |
source |
IEnumerable<TSource> |
The source. |
keySelector |
Func<TSource, IEnumerable<TKey>> |
The key selector. |
elementSelector |
Func<TSource, IEnumerable<TElement>> |
The element selector. |
Return Value
Type |
Description |
IEnumerable<IGrouping<TKey, TElement>> |
A sequence of groups. |