title: Multiple timers accessing dictionary object in a singleton object
body: <p>I have a singleton object and have a dictionary defined in it.</p>
  
  <pre><code>public class MyClass 
  {
      public static readonly MyClass Instance = new MyClass();
  
      private MyClass
      {}
  
      public Dictionary&lt;int, int&gt; MyDictionary = new Dictionary&lt;int, int&gt;();
  }
  </code></pre>
  
  <p>Now, I have two System.Timers.Timer objects updating MyDictionary. </p>
  
  <pre><code>System.Timers.Timer timer1 = new System.Timers.Timer(5);
  timer1.AutoReset = false;
  timer1.Elapsed += new System.Timers.ElapsedEventHandler(MyTimer1Handler);
  timer1.Enabled = true;
  timer1.Start();
  
  System.Timers.Timer timer2 = new System.Timers.Timer(5);
  timer2.AutoReset = false;
  timer2.Elapsed += new System.Timers.ElapsedEventHandler(MyTimer2Handler);
  timer2.Enabled = true;
  timer2.Start();
  
  private void MyTimer1Handler(object sender, ElapsedEventArgs e)
  {
       MyClass.Instance.MyDictonary[1] = 100;
  }
  
  private void MyTimer1Handler(object sender, ElapsedEventArgs e)
  {
       MyClass.Instance.MyDictonary[2] = 100;
  }
  </code></pre>
  
  <p>My question is now, considering the elapsed event handler of timers operate uniquely on index 1 and index 2 of MyDictionary, do I need any lock on MyDictionary ?</p>