MoreEnumerablePartitionTKey, TElement, TResult Method (IEnumerableIGroupingTKey, TElement, TKey, FuncIEnumerableTElement, IEnumerableIGroupingTKey, TElement, TResult) |
Partitions a grouping and projects a result from group elements
matching a key and those groups that do not.
Namespace:
MoreLinq
Assembly:
MoreLinq (in MoreLinq.dll) Version: 2.4.0
Syntax public static TResult Partition<TKey, TElement, TResult>(
this IEnumerable<IGrouping<TKey, TElement>> source,
TKey key,
Func<IEnumerable<TElement>, IEnumerable<IGrouping<TKey, TElement>>, TResult> resultSelector
)
<ExtensionAttribute>
Public Shared Function Partition(Of TKey, TElement, TResult) (
source As IEnumerable(Of IGrouping(Of TKey, TElement)),
key As TKey,
resultSelector As Func(Of IEnumerable(Of TElement), IEnumerable(Of IGrouping(Of TKey, TElement)), TResult)
) As TResult
public:
[ExtensionAttribute]
generic<typename TKey, typename TElement, typename TResult>
static TResult Partition(
IEnumerable<IGrouping<TKey, TElement>^>^ source,
TKey key,
Func<IEnumerable<TElement>^, IEnumerable<IGrouping<TKey, TElement>^>^, TResult>^ resultSelector
)
[<ExtensionAttribute>]
static member Partition :
source : IEnumerable<IGrouping<'TKey, 'TElement>> *
key : 'TKey *
resultSelector : Func<IEnumerable<'TElement>, IEnumerable<IGrouping<'TKey, 'TElement>>, 'TResult> -> 'TResult
Parameters
- source
- Type: System.Collections.GenericIEnumerableIGroupingTKey, TElement
The source sequence. - key
- Type: TKey
The key to partition. - resultSelector
- Type: SystemFuncIEnumerableTElement, IEnumerableIGroupingTKey, TElement, TResult
Function that projects the result from sequences of elements
matching key and those groups that do not (in
the order in which they appear in source),
passed as arguments.
Type Parameters
- TKey
- Type of keys in source groupings.
- TElement
- Type of elements in source groupings.
- TResult
- Type of the result.
Return Value
Type:
TResult
The return value from
resultSelector.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableIGroupingTKey,
TElement. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also