Qbservable.Interval(IQbservableProvider, TimeSpan) method¶
Defined in
Type: Qbservable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IQbservable<long> Interval(this IQbservableProvider provider, TimeSpan period) - 2.
public static IQbservable<long> Interval(this IQbservableProvider provider, TimeSpan period, IScheduler scheduler)
1. Overload¶
public static IQbservable<long> Interval(this IQbservableProvider provider, TimeSpan period)
Summary: Returns an observable sequence that produces a value after each period.
Parameters
| Name | Type | Description |
|---|---|---|
provider | [IQbservableProvider](# | Query provider used to construct the [IQbservable](# data source. |
period | TimeSpan | Period for producing the values in the resulting sequence. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible. |
Returns: IQbservable
Remarks
Intervals are measured between the start of subsequent notifications, not between the end of the previous and the start of the next notification. If the observer takes longer than the interval period to handle the message, the subsequent notification will be delivered immediately after the current one has been handled. In case you need to control the time between the end and the start of consecutive notifications, consider using the Generate operator instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | period is less than TimeSpan.Zero. |
2. Overload¶
public static IQbservable<long> Interval(this IQbservableProvider provider, TimeSpan period, IScheduler scheduler)
Summary: Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.
Parameters
| Name | Type | Description |
|---|---|---|
provider | [IQbservableProvider](# | Query provider used to construct the [IQbservable](# data source. |
period | TimeSpan | Period for producing the values in the resulting sequence. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible. |
scheduler | [IScheduler](# | Scheduler to run the timer on. |
Returns: IQbservable
Remarks
Intervals are measured between the start of subsequent notifications, not between the end of the previous and the start of the next notification. If the observer takes longer than the interval period to handle the message, the subsequent notification will be delivered immediately after the current one has been handled. In case you need to control the time between the end and the start of consecutive notifications, consider using the Generate operator instead.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | period is less than TimeSpan.Zero. |
| System.ArgumentNullException | scheduler is null. |