Show / Hide Table of Contents

Class Scheduler

Represents timer-based scheduler.

Inheritance
object
Scheduler
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public static class Scheduler

Methods

| Edit this page View Source

ScheduleAsync<TArgs>(Func<TArgs, CancellationToken, ValueTask>, TArgs, TimeSpan, CancellationToken)

Schedules the specific action to be executed once after the specified delay.

Declaration
public static Scheduler.DelayedTask ScheduleAsync<TArgs>(Func<TArgs, CancellationToken, ValueTask> callback, TArgs args, TimeSpan delay, CancellationToken token = default)
Parameters
Type Name Description
Func<TArgs, CancellationToken, ValueTask> callback

The callback to be executed after the specified delay.

TArgs args

The arguments to be passed to the callback.

TimeSpan delay

The amount of time used to delay callback execution.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
Scheduler.DelayedTask

The task representing delayed execution.

Type Parameters
Name Description
TArgs

The type of arguments to be passed to the callback.

Exceptions
Type Condition
ArgumentNullException

callback is null.

ArgumentOutOfRangeException

delay is less than Zero and not equal to InfiniteTimeSpan.

| Edit this page View Source

ScheduleAsync<TArgs, TResult>(Func<TArgs, CancellationToken, ValueTask<TResult>>, TArgs, TimeSpan, CancellationToken)

Schedules the specific action to be executed once after the specified delay.

Declaration
public static Scheduler.DelayedTask<TResult> ScheduleAsync<TArgs, TResult>(Func<TArgs, CancellationToken, ValueTask<TResult>> callback, TArgs args, TimeSpan delay, CancellationToken token = default)
Parameters
Type Name Description
Func<TArgs, CancellationToken, ValueTask<TResult>> callback

The callback to be executed after the specified delay.

TArgs args

The arguments to be passed to the callback.

TimeSpan delay

The amount of time used to delay callback execution.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
Scheduler.DelayedTask<TResult>

The task representing delayed execution.

Type Parameters
Name Description
TArgs

The type of arguments to be passed to the callback.

TResult

The type of the result to returned from the callback.

Exceptions
Type Condition
ArgumentNullException

callback is null.

ArgumentOutOfRangeException

delay is less than Zero and not equal to InfiniteTimeSpan.

  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾