Skip to content

M_CommandLine_Infrastructure_EnumerableExtensions_Group__1

Moh.Hassan edited this page Oct 10, 2019 · 1 revision

EnumerableExtensions.Group(T) Method

Breaks a collection into groups of a specified size.

Namespace: CommandLine.Infrastructure
Assembly: CommandLine (in CommandLine.dll) Version: 0.0.0

Syntax

C#

public static IEnumerable<T[]> Group<T>(
	this IEnumerable<T> source,
	int groupSize
)

VB

<ExtensionAttribute>
Public Shared Function Group(Of T) ( 
	source As IEnumerable(Of T),
	groupSize As Integer
) As IEnumerable(Of T())

C++

public:
[ExtensionAttribute]
generic<typename T>
static IEnumerable<array<T>^>^ Group(
	IEnumerable<T>^ source, 
	int groupSize
)

F#

[<ExtensionAttribute>]
static member Group : 
        source : IEnumerable<'T> * 
        groupSize : int -> IEnumerable<'T[]> 

Parameters

 

source
Type: System.Collections.Generic.IEnumerable(T)
A collection of .
groupSize
Type: System.Int32
The number of items each group shall contain.

Type Parameters

 

T

Return Value

Type: IEnumerable(T[])
An enumeration of T[].

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(T). 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).

Remarks

An incomplete group at the end of the source collection will be silently dropped.

See Also

Reference

EnumerableExtensions Class
CommandLine.Infrastructure Namespace

Clone this wiki locally