This is how I write to a stream then read from it using 1 thread:
System.IO.MemoryStream ms = new System.IO.MemoryStream();
// write to it
ms.Write(new byte[] { 1, 2, 3, 4, 5, 6, 7 }, 0, 7);
// go to the begining
ms.Seek(0, System.IO.SeekOrigin.Begin);
// now read from it
byte[] myBuffer = new byte[7];
ms.Read(myBuffer, 0, 7);
Now I was wondering if it is possible to write to the memory-stream from one thread and read that stream from a separate thread.
You can't use a Stream with seeking capabilities from 2 threads simultaneous since a Stream is state full. e.g. A NetworkStream has 2 channels, one for reading and one for writing and therefore can't support seeking.
If you need seeking capabilities, you need to create 2 streams, one for reading and one for writing respectively. Else you can simply create a new Stream type which allows reading and writing from a underlying memory stream by taking exclusive access to the underlying stream and restore its write/read position. A primitive example of that would be: