When you construct a MemoryStream from a byte array, does the stream make its own copy? If, so is this a performance concern in a high performance scenario, when compared to just reading the bytes from the original array directly?
It doesn't seem to be explicitly mentioned in the documentation, but keep in mind that you can use MemoryStream
to modify an existing byte[]
. That wouldn't make any sense if the byte array was copied.
Referring to .NET Reference Source, no copy is made on the byte array.
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