Skip to content

,System.Func{--0,--0},System.Func{--0,--1})} ,System.Func{--0,--0},System.Func{--0,--1},System.Reactive.Concurrency.IScheduler)} ,System.Func{--0,--0},System.Func{--0,--1},System.Func{--0,System.TimeSpan})} ,System.Func{--0,--0},System.Func{--0,--1},System.Func{--0,System.TimeSpan},System.Reactive.Concurrency.IScheduler)} ,System.Func{--0,--0},System.Func{--0,--1},System.Func{--0,System.DateTimeOffset})} ,System.Func{--0,--0},System.Func{--0,--1},System.Func{--0,System.DateTimeOffset},System.Reactive.Concurrency.IScheduler)}

Observable.Generate(TState, Func, Func, Func) method

Defined in

Type: Observable Namespace: System.Reactive.Linq Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector)
  • 2. public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, IScheduler scheduler)
  • 3. 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)
  • 4. 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, IScheduler scheduler)
  • 5. public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector)
  • 6. public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector, IScheduler scheduler)

1. Overload

public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector)

Summary: Generates an observable sequence by running a state-driven loop producing the sequence's elements.

Type parameters

NameDescription
TStateThe type of the state used in the generator loop.
TResultThe type of the elements in the produced sequence.

Parameters

NameTypeDescription
initialStateTStateInitial state.
conditionFuncCondition to terminate generation (upon returning false).
iterateFuncIteration step function.
resultSelectorFuncSelector function for results produced in the sequence.

Returns: IObservable -- The generated sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptioncondition or iterate or resultSelector is null.

2. Overload

public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, IScheduler scheduler)

Summary: Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.

Type parameters

NameDescription
TStateThe type of the state used in the generator loop.
TResultThe type of the elements in the produced sequence.

Parameters

NameTypeDescription
initialStateTStateInitial state.
conditionFuncCondition to terminate generation (upon returning false).
iterateFuncIteration step function.
resultSelectorFuncSelector function for results produced in the sequence.
scheduler[IScheduler](#Scheduler on which to run the generator loop.

Returns: IObservable -- The generated sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptioncondition or iterate or resultSelector or scheduler is null.

3. Overload

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)

Summary: Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements.

Type parameters

NameDescription
TStateThe type of the state used in the generator loop.
TResultThe type of the elements in the produced sequence.

Parameters

NameTypeDescription
initialStateTStateInitial state.
conditionFuncCondition to terminate generation (upon returning false).
iterateFuncIteration step function.
resultSelectorFuncSelector function for results produced in the sequence.
timeSelectorFuncTime selector function to control the speed of values being produced each iteration.

Returns: IObservable -- The generated sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptioncondition or iterate or resultSelector or timeSelector is null.

4. Overload

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, IScheduler scheduler)

Summary: Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements, using the specified scheduler to run timers and to send out observer messages.

Type parameters

NameDescription
TStateThe type of the state used in the generator loop.
TResultThe type of the elements in the produced sequence.

Parameters

NameTypeDescription
initialStateTStateInitial state.
conditionFuncCondition to terminate generation (upon returning false).
iterateFuncIteration step function.
resultSelectorFuncSelector function for results produced in the sequence.
timeSelectorFuncTime selector function to control the speed of values being produced each iteration.
scheduler[IScheduler](#Scheduler on which to run the generator loop.

Returns: IObservable -- The generated sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptioncondition or iterate or resultSelector or timeSelector or scheduler is null.

5. Overload

public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector)

Summary: Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements.

Type parameters

NameDescription
TStateThe type of the state used in the generator loop.
TResultThe type of the elements in the produced sequence.

Parameters

NameTypeDescription
initialStateTStateInitial state.
conditionFuncCondition to terminate generation (upon returning false).
iterateFuncIteration step function.
resultSelectorFuncSelector function for results produced in the sequence.
timeSelectorFuncTime selector function to control the speed of values being produced each iteration.

Returns: IObservable -- The generated sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptioncondition or iterate or resultSelector or timeSelector is null.

6. Overload

public static IObservable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector, Func<TState, DateTimeOffset> timeSelector, IScheduler scheduler)

Summary: Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements, using the specified scheduler to run timers and to send out observer messages.

Type parameters

NameDescription
TStateThe type of the state used in the generator loop.
TResultThe type of the elements in the produced sequence.

Parameters

NameTypeDescription
initialStateTStateInitial state.
conditionFuncCondition to terminate generation (upon returning false).
iterateFuncIteration step function.
resultSelectorFuncSelector function for results produced in the sequence.
timeSelectorFuncTime selector function to control the speed of values being produced each iteration.
scheduler[IScheduler](#Scheduler on which to run the generator loop.

Returns: IObservable -- The generated sequence.

Exceptions

TypeCondition
System.ArgumentNullExceptioncondition or iterate or resultSelector or timeSelector or scheduler is null.