❔ Protips to write thing like: raise Alarm when Time hits DateTime.Now
How can I achieve this? I know that I need to use events. DispatcherTimer as well?
2 Replies
Why would you want to wait until DateTime.Now?
But if you want to wait until a certain time, you should look into DateTime and TimeSpan
Easy to work with. DateTime is an instance of time and TimeSpan is a span of time, say a few seconds, hours or days. Task.Delay takes a TimeSpan and subtracting two DateTime objects returns a TimeSpan between the two
Is this an example of what you want?
A Timer would repeat itself unless you set the period to an infinite time span
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.