How to remove bytes from MemoryStream

Dotaz How to remove bytes from MemoryStream

  • 2009年2月4日 上午 01:15
     
      包含代碼
    I'm reading binary data into a MemoryStream object and every so often, I'd like to chomp off all the bytes before MemoryStream.Position (effectively setting the current position as the beginning of the stream).  I'd like to do this in order to allow the memory to be freed.  These will be long lived objects, accumulating lots of data, hence it is necessary to "trim" it every once in a while.

    Thanks in advance for the help!