Given the following: byte[] sData; and a function declared as private byte[] construct_command()
if I were to then assign the result of construct_command() to sData would sData just point to the contents of what's returned from the function or would some space be alloctaed for sData in memory and the contents of the result of the function be copied into it?
The assignment will simply assign the sData to reference the instance returned by construct_command. No copying of data will occur.
In general, the CLR breaks the world down into 2 types
Arrays are reference types in the CLR and hence do not cause a copying of the underlying value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With