Click or drag to resize

GeneratorGroupTSource Method (IGeneratorTSource, Int32)

Makes a generator that returns groups of elements from the source generator.

Namespace:  Gamelogic.Extensions.Algorithms
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static IGenerator<IList<TSource>> Group<TSource>(
	this IGenerator<TSource> generator,
	int groupSize
)

Parameters

generator
Type: Gamelogic.Extensions.AlgorithmsIGeneratorTSource
The source generator.
groupSize
Type: SystemInt32
The size of the groups.

Type Parameters

TSource
The type of the source generator.

Return Value

Type: IGeneratorIListTSource
IGenerator<IEnumerable<TSource>>.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IGeneratorTSource. 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).
Exceptions
ExceptionCondition
ArgumentNullExceptiongenerator
ArgumentOutOfRangeExceptiongroupSize;Argument must be positive.
Remarks
For example, if the source generator generates 0, 1, 2, 3, ... and the group size is 2 then the result generator will return groups (0, 1), (2, 3), ...
See Also