EnumerableExGenerateTState, TResult Method |
Generates a sequence by mimicking a for loop.
Namespace: System.LinqAssembly: System.Interactive (in System.Interactive.dll) Version: 1.2.0.0
Syntaxpublic static IEnumerable<TResult> Generate<TState, TResult>(
TState initialState,
Func<TState, bool> condition,
Func<TState, TState> iterate,
Func<TState, TResult> resultSelector
)
Parameters
- initialState
- Type: TState
Initial state of the generator loop. - condition
- Type: SystemFuncTState, Boolean
Loop condition. - iterate
- Type: SystemFuncTState, TState
State update function to run after every iteration of the generator loop. - resultSelector
- Type: SystemFuncTState, TResult
Result selector to compute resulting sequence elements.
Type Parameters
- TState
- State type.
- TResult
- Result sequence element type.
Return Value
Type:
IEnumerableTResultSequence obtained by running the generator loop, yielding computed elements.
See Also