title: Method lock in c#
body: <p>I have one class with these three methods. This class is used by many threads.
  I would like the Method1 to wait, if Method2 and/or Method3 are running in any threads.
  Any suggestions?</p>
  
  <pre><code>public class Class1
  {
      public static void Method1() 
      {
          Object lockThis = new Object();
  
          lock (lockThis)
          {
              //Body function
          }
      }
  
      public static void Method2() 
      {
           //Body function
      }
  
      public static void Method3() 
      {
           //Body function
      }
  }
  </code></pre>