title: Using Timer class properly
body: <p>I would like to know if the code I wrote is a properly written one, it does function, but I've done bad designs before, so I need to know if I thought this in a proper way. </p>
  
  <p>Code is about using a System.Timers.Timer to do a repeated action each X hours. I read some threads about this subject on stackoverflow and then I tried writing my own class. Here is what I wrote:</p>
  
  <pre><code>namespace MyTool
  {
  public  class UpdaterTimer : Timer
  {
      private static UpdaterTimer _timer;
      protected UpdaterTimer()
      { }
  
      public static UpdaterTimer GetTimer()
      {
          if (_timer == null)
              _timer = new UpdaterTimer();
  
          SetTimer(_timer);
          return _timer;
      }
  
      private static void SetTimer(UpdaterTimer _timer)
      {
          _timer.AutoReset = true;
          _timer.Interval = Utils.TimeBetweenChecksInMiliseconds;
          _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
          _timer.Start();
          DoStuff();
      }
  
      static void _timer_Elapsed(object sender, ElapsedEventArgs e)
      {
          DoStuff();
      }
  
      private static void DoStuff()
      {
         //does stuff on each elapsed event occurrence
      }
  }
  }
  </code></pre>
  
  <p>Short description: </p>
  
  <ul>
  <li>tried using a singleton pattern since I only need one timer to work</li>
  <li>I'm not sure about calling DoStuff() inside the SetTimer() method, it seems redundant. But the logic is that, when the app starts, DoStuff() must run, and then it must run again on each Timer.Elapsed event. </li>
  </ul>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Would you have written this behavior in a different way, given the specification? </li>
  <li>Is it ok to use a singleton in this case, or it doesn't make sense?</li>
  </ol>