Observable.Generate<TState, TResult> Method (TState, Func<TState, Boolean>, Func<TState, TState>, Func<TState, TResult>, Func<TState, TimeSpan>)
Generates an observable sequence by iterating a state from an initial state until the condition fails.
Namespace: System.Reactive.Linq
Assembly: System.Reactive (in System.Reactive.dll)
Syntax
'Declaration
Public Shared Function Generate(Of TState, TResult) ( _
initialState As TState, _
condition As Func(Of TState, Boolean), _
iterate As Func(Of TState, TState), _
resultSelector As Func(Of TState, TResult), _
timeSelector As Func(Of TState, TimeSpan) _
) As IObservable(Of TResult)
'Usage
Dim initialState As TState
Dim condition As Func(Of TState, Boolean)
Dim iterate As Func(Of TState, TState)
Dim resultSelector As Func(Of TState, TResult)
Dim timeSelector As Func(Of TState, TimeSpan)
Dim returnValue As IObservable(Of TResult)
returnValue = Observable.Generate(initialState, _
condition, iterate, resultSelector, _
timeSelector)
public static IObservable<TResult> Generate<TState, TResult>(
TState initialState,
Func<TState, bool> condition,
Func<TState, TState> iterate,
Func<TState, TResult> resultSelector,
Func<TState, TimeSpan> timeSelector
)
public:
generic<typename TState, typename TResult>
static IObservable<TResult>^ Generate(
TState initialState,
Func<TState, bool>^ condition,
Func<TState, TState>^ iterate,
Func<TState, TResult>^ resultSelector,
Func<TState, TimeSpan>^ timeSelector
)
static member Generate :
initialState:'TState *
condition:Func<'TState, bool> *
iterate:Func<'TState, 'TState> *
resultSelector:Func<'TState, 'TResult> *
timeSelector:Func<'TState, TimeSpan> -> IObservable<'TResult>
JScript does not support generic types and methods.
Type Parameters
- TState
The type of state.
- TResult
The type of result.
Parameters
- initialState
Type: TState
The initial state.
- condition
Type: System.Func<TState, Boolean>
The condition to terminate generation.
- iterate
Type: System.Func<TState, TState>
The iteration step function.
- resultSelector
Type: System.Func<TState, TResult>
The selector function for results produced in the sequence.
- timeSelector
Type: System.Func<TState, TimeSpan>
The time selector function to control the speed of values being produced each iteration.
Return Value
Type: System.IObservable<TResult>
The generated sequence.