How to save class object to file and then encrypt it with open and closed key.
closed key must be one for all (just for safe)
and open key must be different for each file.
I want use this code ... Looking like it is what I want but I still need Encryption.
    public ObjectToFile(_Object : object, _FileName : string) : bool
{
    try
    {
        // create new memory stream
        mutable _MemoryStream : System.IO.MemoryStream = System.IO.MemoryStream();
        // create new BinaryFormatter
        def _BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
                    = System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
        // Serializes an object, or graph of connected objects, to the given stream.
        _BinaryFormatter.Serialize(_MemoryStream, _Object);
        // convert stream to byte array
        mutable _ByteArray : array[byte] = _MemoryStream.ToArray();
        // Open file for writing
        def _FileStream : System.IO.FileStream = 
        System.IO.FileStream(_FileName, System.IO.FileMode.Create, System.IO.FileAccess.Write);
        // Writes a block of bytes to this stream using data from a byte array.
        _FileStream.Write(_ByteArray, 0, _ByteArray.Length);
        // close file stream
        _FileStream.Close();
        // cleanup
        _MemoryStream.Close();
        _MemoryStream.Dispose();
        _MemoryStream = null;
        _ByteArray = null;
         true
    }
    catch
    {
        | e is Exception => // Error
        {
            Console.WriteLine("Exception caught in process: {0}", e.ToString());
            false
        }
    }
}
to moderators : please don't remove C# tag, because I'm able to get C# answer and there is low chances to get nemerle answer :)