I am trying to create a function that takes in an Action and a Timeout, and executes the Action after the Timeout. The function is to be non-blocking. The function must be
I use this method to schedule a task for a specific time:
public void ScheduleExecute(Action action, DateTime ExecutionTime)
{
Task WaitTask = Task.Delay(ExecutionTime.Subtract(DateTime.Now));
WaitTask.ContinueWith(() => action());
WaitTask.Start();
}
It should be noted that this only works for about 24 days out because of int32 max value.