Observable.Generate < TState, TResult > 方法 (TState, Func < TState, Boolean > , Func < TState, TState > , Func TState, TResult > , Func << TState, TimeSpan >)
從初始狀態逐一查看狀態,直到條件失敗為止,以產生可觀察的序列。
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), _
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.
類型參數
- TState
狀態的類型。
- TResult
結果的類型。
參數
- initialState
類型:TState
初始狀態。
- condition (條件)
類型:System.Func< TState、Boolean>
要終止產生的條件。
- 逐一查看
類型:System.Func< TState、TState>
反復專案步驟函式。
- resultSelector
類型:System.Func< TState、TResult>
序列中產生之結果的選取器函式。
- timeSelector
類型:System.Func< TState、TimeSpan>
時間選取器函式,可控制每次反覆運算所產生的值速度。
傳回值
類型:System.IObservable< TResult>
產生的序列。