Skip to main content

How to Create Dynamic Timers

caution

Do not use implicit timers, use expression timers with parameters instead.

You can utilize parameters as the timer value. Supported types include DateTime, TimeSpan, string, and int:

  • DateTime - the timer will be set to the received date.
  • TimeSpan - the value will be added to the current date.
  • string - it will trigger an interval timer if possible. Otherwise, the method GetCustomTimerValueAsync will be called.
  • int - the value will be added to the current date as milliseconds.

For more information about timers you can refer here and about GetCustomTimerValueAsync method here.

Example of working with expression timer with parameters.