title: Using a timer to call a single/multiple method in a console application
body: <p>I've created a console application that needs to run in the background of my client application and has to invoke a method after a certain period of time. So far I've tried the below with little success but it doesn't seem to be working.</p>
  
  <p>Furthermore, in a situation where I wanted to use the same timer to invoke more than one method, then what would I do?</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          Console.ReadLine();
          const bool generate = true;
          NewBookingTimer(generate);
      }
  
      public static void NewBookingTimer(bool generate)
      {
          if (!generate) return;
          var newBookingTimer = new Timer();
          newBookingTimer.Elapsed += (sender, e) =&gt; NewBooking();
          var random = new Random();
          int randomNumber = random.Next(0, 500);
          newBookingTimer.Interval = randomNumber;
          newBookingTimer.Enabled = true;
      }
  
      public static void NewBooking()
      {
          var dbObject = new DbConnect();
          dbObject.OpenConnection();
          var bookingObject = new GenerateBooking();
          bookingObject.NewBooking();
      }
  }
  </code></pre>