Skip to content

)} )}

Scheduler.SchedulePeriodic(IScheduler, TState, TimeSpan, Func) method

Defined in

Type: Scheduler Namespace: System.Reactive.Concurrency Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Func<TState, TState> action)
  • 2. public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Action<TState> action)
  • 3. public static IDisposable SchedulePeriodic(this IScheduler scheduler, TimeSpan period, Action action)

1. Overload

public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Func<TState, TState> action)

Summary: Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation. If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage. Otherwise, the periodic task will be emulated using recursive scheduling.

Type parameters

NameDescription
TStateThe type of the state passed to the scheduled action.

Parameters

NameTypeDescription
scheduler[IScheduler](#The scheduler to run periodic work on.
stateTStateInitial state passed to the action upon the first iteration.
periodTimeSpanPeriod for running the work periodically.
actionFuncAction to be executed, potentially updating the state.

Returns: IDisposable -- The disposable object used to cancel the scheduled recurring action (best effort).

Exceptions

TypeCondition
System.ArgumentNullExceptionscheduler or action is null.
System.ArgumentOutOfRangeExceptionperiod is less than Zero.

2. Overload

public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Action<TState> action)

Summary: Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation. If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage. Otherwise, the periodic task will be emulated using recursive scheduling.

Type parameters

NameDescription
TStateThe type of the state passed to the scheduled action.

Parameters

NameTypeDescription
scheduler[IScheduler](#Scheduler to execute the action on.
stateTStateState passed to the action to be executed.
periodTimeSpanPeriod for running the work periodically.
actionActionAction to be executed.

Returns: IDisposable -- The disposable object used to cancel the scheduled recurring action (best effort).

Exceptions

TypeCondition
System.ArgumentNullExceptionscheduler or action is null.
System.ArgumentOutOfRangeExceptionperiod is less than Zero.

3. Overload

public static IDisposable SchedulePeriodic(this IScheduler scheduler, TimeSpan period, Action action)

Summary: Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation. If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage. Otherwise, the periodic task will be emulated using recursive scheduling.

Parameters

NameTypeDescription
scheduler[IScheduler](#Scheduler to execute the action on.
periodTimeSpanPeriod for running the work periodically.
actionActionAction to be executed.

Returns: IDisposable -- The disposable object used to cancel the scheduled recurring action (best effort).

Exceptions

TypeCondition
System.ArgumentNullExceptionscheduler or action is null.
System.ArgumentOutOfRangeExceptionperiod is less than Zero.