Click or drag to resize

XEnumerableGenerateTElement Method (FuncInt32, TElement)

Generates a sequence from an index-based generator function.

Namespace:  Linq.Extras
Assembly:  Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
public static IEnumerable<TElement> Generate<TElement>(
	Func<int, TElement> generator
)

Parameters

generator
Type: SystemFuncInt32, TElement
A generator function that returns an element based on its index.

Type Parameters

TElement
The type of the elements in the sequence.

Return Value

Type: IEnumerableTElement
An sequence of elements generated from their index.
Remarks
The index varies from 0 (inclusive) to int.MaxValue (exclusive), so the output sequence contains int.MaxValue elements.
See Also