In .net applications there is a very useful feature which allows us to serialise an object as either xml or binary data.
What that means is that we can take an instance of an object running in our program and with just a few lines of code we can persist this to disk for example so that later on, perhaps even after we have closed down the program and opened it up another day, we are able to read that data back from disk and recreate our object just as it was when we serialised it.
This is incredibly useful particularly since we do not have to persist to disk. We can serialise our object to a stream which gives us endless possibiliies. For example we can serialise an object and transfer it across a network and recreate it at the other end - just like the transporters on Star Trek!
As well as being able to serialise to streams, we can also serialise to TextWriters and StreamWriters. The following artilcle looks at this in a lot of depth with code samples included.
http://www.audacs.co.uk/ViewPage.aspx?PageID=493