title: C# can I lock a method parameter?
body: <p>We have a class variable <code>ArrayList binaryScanData</code> in a class. In all methods having access to it, we put <code>lock(binaryScanData)</code> on it because it is shared. Now we want to move one of those methods out to another util class to make it a <code>static</code> method. We will pass that <code>binaryScanData</code> into the method like this:</p>
  
  <p><code>public static void convertAndSaveRawData(ref MemoryStream output, ref ArrayList binaryScanData)</code></p>
  
  <p>Our questions are followed:</p>
  
  <ol>
  <li>how can we sychoronize that <code>binaryScanData</code>? can we do the same as it is originally?</li>
  <li><code>ref</code> is necessary? It will only be read in that <code>convertAndSaveRawData</code> method.</li>
  </ol>