Click or drag to resize

GeneratorNextWhileTSource Method

Generates the elements from the generator while the predicate applied to elements hold an return them in an enumerable. After calling this method, the next element returned by Next (or the current value of Current) will not satisfy the predicate.

Namespace:  Gamelogic.Extensions.Algorithms
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static IEnumerable<TSource> NextWhile<TSource>(
	this IGenerator<TSource> source,
	Func<TSource, bool> predicate
)

Parameters

source
Type: Gamelogic.Extensions.AlgorithmsIGeneratorTSource
The source generator.
predicate
Type: SystemFuncTSource, Boolean
The predicate.

Type Parameters

TSource
The type of the source generator.

Return Value

Type: IEnumerableTSource
A new enumerator.

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).
Examples
The enumerable in the following will contain the elements 0, 1, 2, 3:
var list = Generator.Count(100).NextWhile(x => x < 4);
See Also