Click or drag to resize

GeneratorSkipAndTakeTSource Method

Makes a generator that repeatedly skips over and takes elements from a given generator.

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

Parameters

generator
Type: Gamelogic.Extensions.AlgorithmsIGeneratorTSource
The source generator.
skipCount
Type: SystemInt32
The number of elements to skip each cycle.
takeCount
Type: SystemInt32
The number of elements to take each cycle.

Type Parameters

TSource
The type of elements of the source generator.

Return Value

Type: IGeneratorTSource
A new generator.

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 is null.
ArgumentOutOfRangeExceptiontakeCount is not larger than 0.
ArgumentOutOfRangeExceptionskipCount is negative.
Examples
The following generator will generate 0 1 2 4 5 6 8 9 10...
var generator = Generator
    .Count(100)
    .TakeAndSkip(3, 1);
See Also