Method RegisterAsyncTimeOfDay
RegisterAsyncTimeOfDay(IPrimeClock, LocalTime, Func<CancellationToken, ValueTask>, CancellationToken, DayTimeTimerOptions?)
Registers a time-of-day timer with an asynchronous callback.
public static IClockDayTimeTimer RegisterAsyncTimeOfDay(this IPrimeClock clock, LocalTime timeOfDay, Func<CancellationToken, ValueTask> callback, CancellationToken cancellationToken, DayTimeTimerOptions? timerOptions = null)
Parameters
clockIPrimeClocktimeOfDayLocalTimeThe local time of day at which to fire.
callbackFunc<CancellationToken, ValueTask>The async callback (returns ValueTask).
cancellationTokenCancellationTokenToken that participates in cancelling the timer registration and is passed to the callback; use None when no external cancellation is required.
timerOptionsDayTimeTimerOptionsOptional day-time timer options.
Returns
- IClockDayTimeTimer
An IClockDayTimeTimer to monitor or change the timer.
RegisterAsyncTimeOfDay(IPrimeClock, LocalTimeOfDay, Func<ClockTimerCallbackContext, CancellationToken, ValueTask>, CancellationToken, object?, DayTimeTimerOptions?)
Registers a time-of-day timer with an asynchronous callback that receives context and cancellation token, using BCL LocalTimeOfDay.
public static IClockDayTimeTimer RegisterAsyncTimeOfDay(this IPrimeClock clock, LocalTimeOfDay timeOfDay, Func<ClockTimerCallbackContext, CancellationToken, ValueTask> callback, CancellationToken cancellationToken, object? state = null, DayTimeTimerOptions? timerOptions = null)
Parameters
clockIPrimeClocktimeOfDayLocalTimeOfDayThe local time of day at which to fire.
callbackFunc<ClockTimerCallbackContext, CancellationToken, ValueTask>The async callback; receives timer context and a cancellation token.
cancellationTokenCancellationTokenToken that participates in cancelling the timer registration and is passed to the callback; use None when no external cancellation is required.
stateobjectOptional state passed to the callback via ClockTimerCallbackContext.
timerOptionsDayTimeTimerOptionsOptional day-time timer options.
Returns
- IClockDayTimeTimer
An IClockDayTimeTimer to monitor or change the timer.
Remarks
Only supported in .NET 8+. Not supported in NetStandard 2.0.
RegisterAsyncTimeOfDay(IPrimeClock, LocalTimeOfDay, Func<CancellationToken, ValueTask>, CancellationToken, DayTimeTimerOptions?)
Registers a time-of-day timer with an asynchronous callback, using BCL LocalTimeOfDay.
public static IClockDayTimeTimer RegisterAsyncTimeOfDay(this IPrimeClock clock, LocalTimeOfDay timeOfDay, Func<CancellationToken, ValueTask> callback, CancellationToken cancellationToken, DayTimeTimerOptions? timerOptions = null)
Parameters
clockIPrimeClocktimeOfDayLocalTimeOfDayThe local time of day at which to fire.
callbackFunc<CancellationToken, ValueTask>The async callback (returns ValueTask).
cancellationTokenCancellationTokenToken that participates in cancelling the timer registration and is passed to the callback; use None when no external cancellation is required.
timerOptionsDayTimeTimerOptionsOptional day-time timer options.
Returns
- IClockDayTimeTimer
An IClockDayTimeTimer to monitor or change the timer.
Remarks
Only supported in .NET 8+. Not supported in NetStandard 2.0.