title: Locking on an object
body: <p>I often see code like that which is <a href="http://msdn.microsoft.com/en-us/library/ak9w5846.aspx" rel="noreferrer">shown here</a>, ie where an object is allocated and then used as a "lock object".</p>
  
  <p>It seems to me that you could use any object for this, including the event itself as the lock object.  Why allocate a new object that does nothing?  My understanding is that calling lock() on an object doesn't actually alter the object itself, nor does it actually lock it from being used, it's simply used as a placeholder for multiple lock statements to anchor on.</p>
  
  <pre><code>public class Shape : IDrawingObject, IShape
  {
      // Create an event for each interface event
      event EventHandler PreDrawEvent;
      event EventHandler PostDrawEvent;
  
      object objectLock = new Object();
  
      // Explicit interface implementation required.
      // Associate IDrawingObject's event with
      // PreDrawEvent
      event EventHandler IDrawingObject.OnDraw
      {
          add
          {
              lock (objectLock)
              {
                  PreDrawEvent += value;
              }
          }
          remove
          {
              lock (objectLock)
              {
                  PreDrawEvent -= value;
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>So my question is, is this really a good thing to do?</strong>  </p>