You need to create an object that can be serialized (converted to a stream of bytes).
Add the Serializable attribute to your class.
Serializable objects can be converted into a stream of bytes and recreated at a later point in time. You can use serialization to save an object to disk (as explained in recipe Serialize an Object to Disk) or to send an object between application domains with .NET Remoting (in which case, the .NET runtime manages the serialization and deserialization transparently).
In order for serialization to work, your object must meet all the following criteria:
The object must have a Serializable attribute preceding the class declaration.
All the public and private variables of ...