Twitter












MemoryStream.ToArray() VS MemoryStream.GetBuffer()

Note that the buffer contains allocated bytes which might be unused. For example, if the string "test" is written into the MemoryStream object, the length of the buffer returned from GetBuffer is 256, not 4, with 252 bytes unused. To obtain only the data in the buffer, use the ToArray method; however, ToArray creates a copy of the data in memory.


Feedback

# re: MemoryStream.ToArray() VS MemoryStream.GetBuffer()

Nice! What i'm looking for. 9/11/2013 10:19 AM | Andre Soares