title: Lock private object or the hashset itself?
body: <p>Assume that i have the hashset below</p>
  
  <pre><code>   HashSet&lt;string&gt; hsWaitingToBeFetched = new HashSet&lt;string&gt;();
  </code></pre>
  
  <p>Now i am doing multithreading programming so i have to lock this in order to sync objects</p>
  
  <p><strong>I can lock this with both way are there any performance difference ?</strong></p>
  
  <pre><code>private Object lockHashset = new Object();
  lock(lockHashset)
  {
  // do stuff here
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>lock(hsWaitingToBeFetched)
  {
  // do stuff here
  }
  </code></pre>