Bagikan melalui


Observable.Generate<TState, TResult> Method (TState, Func<TState, Boolean>, Func<TState, TState>, Func<TState, TResult>)

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) _
) 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 returnValue As IObservable(Of TResult)

returnValue = Observable.Generate(initialState, _
    condition, iterate, resultSelector)
public static IObservable<TResult> Generate<TState, TResult>(
    TState initialState,
    Func<TState, bool> condition,
    Func<TState, TState> iterate,
    Func<TState, TResult> resultSelector
)
public:
generic<typename TState, typename TResult>
static IObservable<TResult>^ Generate(
    TState initialState, 
    Func<TState, bool>^ condition, 
    Func<TState, TState>^ iterate, 
    Func<TState, TResult>^ resultSelector
)
static member Generate : 
        initialState:'TState * 
        condition:Func<'TState, bool> * 
        iterate:Func<'TState, 'TState> * 
        resultSelector:Func<'TState, 'TResult> -> 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.
  • 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.

Return Value

Type: System.IObservable<TResult>
The generated sequence.

See Also

Reference

Observable Class

Generate Overload

System.Reactive.Linq Namespace