I want to run the timer at 2:00 a.m. and shutdown the application.This is my code:  var ShutdownTimer = new Timer();  var currentTime = DateTime.Now;  int hoursUntilShutdown;  switch (currentTime.Hour)  {    case 1:      hoursUntilShutdown = 1;      break;    case 2:      hoursUntilShutdown = 0;      break;    default:      hoursUntilShutdown = (24 - currentTime.Hour) + 2;      break;  }  var shutdownTimeSpan = new TimeSpan(0, hoursUntilShutdown, 0, 0);  ShutdownTimer.Interval = (int)shutdownTimeSpan.TotalMilliseconds;  ShutdownTimer.Tick += this.OnShutdownTimer;  ShutdownTimer.Start();   private void OnShutdownTimer(object sender, EventArgs e)   {       Environment.Exit(0);   }Any help will be greatly appreciated!
I want to run the timer at 2:00 a.m. and shutdown the application
c#;.net
The whole switch can be replaced byhoursUntilShutdown = (26 - currentTime.Hour) % 24where % is the remainder of the division, as in C (I don't use C#, so I can only assume it's the same).