Skip to main content

RunOnce Method

Runs a method once, after the specified interval.

Definition​

Namespace: Avalonia.Threading
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static IDisposable RunOnce(
Action action,
TimeSpan interval,
DispatcherPriority priority = default
)

Parameters​

  Action
The method to call after the interval has elapsed.
  TimeSpan
The interval after which to call the method.
  DispatcherPriority  (Optional)
The priority to use.

Return Value​

IDisposable
An IDisposable used to cancel the timer.

See Also​

Reference​

DispatcherTimer Class
Avalonia.Threading Namespace