Skip to content

ObservableAsync.Interval(TimeSpan) method

Defined in

Type: ObservableAsync Namespace: ReactiveUI.Extensions.Async Assembly: ReactiveUI.Extensions.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Overloads

  • 1. public static IObservableAsync<long> Interval(TimeSpan period)
  • 2. public static IObservableAsync<long> Interval(TimeSpan period, TimeProvider? timeProvider)

1. Overload

public static IObservableAsync<long> Interval(TimeSpan period)

View source

Summary: Creates an asynchronous observable sequence that emits a long integer value at each specified time interval.

Parameters

NameTypeDescription
periodTimeSpanThe time interval between emissions of values. Must be a positive duration.

Returns: IObservableAsync -- An ObservableAsync that emits an increasing long value at each interval, starting from 1, until the sequence is cancelled.

Remarks

The sequence continues emitting values until the observer unsubscribes or the cancellation token is triggered. This method is useful for generating periodic events or timers in asynchronous workflows.

2. Overload

public static IObservableAsync<long> Interval(TimeSpan period, TimeProvider? timeProvider)

View source

Summary: Creates an asynchronous observable sequence that emits a long integer value at each specified time interval.

Parameters

NameTypeDescription
periodTimeSpanThe time interval between emissions of values. Must be a positive duration.
timeProviderTimeProvider?An optional time provider used to control the timing of emissions. If null or set to TimeProvider.System, the system clock is used.

Returns: IObservableAsync -- An ObservableAsync that emits an increasing long value at each interval, starting from 1, until the sequence is cancelled.

Remarks

The sequence continues emitting values until the observer unsubscribes or the cancellation token is triggered. This method is useful for generating periodic events or timers in asynchronous workflows.