A "Stream" of thought..
Streams are interesting (and very useful) entities. We can define them as an abstraction of a series of bytes of data in some store which we can read or write to. Stream is really powerful concept as it provides a unified way of accessing data present in various sources like a file, a network source or some memory location. We weren't really exposed to the concept of streams in VB6, except for some sporadic usage of the ADO Stream object.
.NET has extensive support for Streams, System.IO.Stream being the base class for all streams. Depending on the underlying backing store, you have specific stream classes like FileStream, CryptoStream, NetworkStream and MemoryStream etc. Here, I am particularly interested in MemoryStream which has memory as the backing store. I can think of two situations where MemoryStream can be really useful:
1. For Cloning objects:
MemoryStream provides an elegant way of cloning objects wherein, you can serialize an object to a memory stream and then deserialize that back into a new object
For more info on cloning objects, refer to http://www.codeproject.com/dotnet/Clone.asp
2. Using memory stream as a temporary buffer:
It is pretty customary to open up a FileStream object (like a log file) early in the application, write to it at regular intervals, and then close it before terminating the application. Taking a write lock on the file for a large amount of time can be unacceptable, especially if you have other applications or threads waiting to write to the same file. So, as a remedy, you can write the entries to a memorystream and a some logical point of time, just copy the contents to the FileStream by using the WriteTo method. I suppose, this is analogous to the “acquire late, release early” semantics of transaction related locks.
Refer to this article for more insight into streams: http://archive.devx.com/dotnet/articles/ep070202/ep070202-1.asp. What you have seen is just the tip of the iceberg!