Article:
  .NET Serialization, Part 1
Subject:   MemoryStream.Position
Date:   2006-07-19 07:29:18
From:   toddstibor
Response to: MemoryStream.Position

After writing to a stream, the position of the stream is at the end of the stream. If you try to immediatly read from the exact same stream, you will start to read from the end, where you left of writing. Therefore, you need to rewind the stream to the beginning before you read from it.


During normal operations, this is not a problem because you are writing to one end of a "pipe" with one stream object, and reading from the other end of the "pipe" with another stream object; usually, the ends of the "pipe" are in different processes anyway.