Difference between MemoryStream Read() and GetBuffer().


  • Any one tell me the exact difference between MemoryStream Read() method and GetBuffer(). I want an exact behavoiur of these two methods.



    Saturday, March 18, 2006 8:15 AM

All replies

  • Hi!

    Read() will copy bytes into YOUR buffer, GetBuffer() will give you access to OWN buffer that MemoryStream use for itself.

    I don't think you can keep GetBuffer()-given reference too long, because when stream write something it can reallocate buffer.

    Saturday, March 18, 2006 11:25 PM