共用方式為


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

在條件失敗之前,從初始狀態逐一查看狀態,以產生可觀察的序列。

Namespace:System.Reactive.Linq
裝配: System.Reactive.dll) 中的 System.Reactive (

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.

類型參數

  • TState
    狀態的類型。
  • TResult
    結果的類型。

參數

  • initialState
    類型:TState
    初始狀態。
  • 逐一查看
    類型:System.Func< TState、TState>
    反復專案步驟函式。
  • resultSelector
    類型:System.Func< TState、TResult>
    序列中產生結果的選取器函式。

傳回值

類型:System.IObservable< TResult>
產生的序列。

另請參閱

參考

Observable 類別

產生多載

System.Reactive.Linq 命名空間