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