I need to call a function at a specific time during a day. There are other examples in the internet using, Timer etc. But I am wondering, why not simply have a thread which calls a method having a while loop.
while (true)
{
if (DateTime.Now.TimeOfDay == new TimeSpan(0, 0, 0))
{
ManualTaskProcession();
}
}
This will be run on a separate thread - wondering why this approach is not mentioned anywhere, or is it correct?
P.S This is inside a Windows Service.