I am using a memory stream like this:
public static byte[] myMethod()
{
using(MemoryStream stream = new MemoryStream())
{
//some processing here.
return stream.toArray();
}
}
I am assigning the returned byte array in the caller method like this:
public static void callerMethod()
{
byte[] myData = myMethod();
//Some processing on data array here
}
Is the returned byte array passed by reference or by value? If the returned array is by reference does that mean at any time I may have myData in the callerMethod array to be null at any time while I am still processing the data?