✅ MemoryStream question
If I have a byte[], and I'm instantiating a MemoryStream with this byte array, does it occupy twice the memory? Or is the MemoryStream simply referring to the byte array instead of copying the contents in the array?
3 Replies
Source code shows that it refers, doesn't copy
but it will expand the buffer when writing to the stream past the initial capacity
at which point it will allocate a new array and will no longer refer to the original
that's given
writable
is set to true
, of course. which it is by default, when you use the MemoryStream(byte[])
constructorthanks