C# can I lock a method parameter?
Posted
by 5YrsLaterDBA
on Stack Overflow
See other posts from Stack Overflow
or by 5YrsLaterDBA
Published on 2010-04-28T14:53:56Z
Indexed on
2010/04/28
16:03 UTC
Read the original article
Hit count: 491
c#
|multithreading
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 thatconvertAndSaveRawData
method.
© Stack Overflow or respective owner