Ejemplo n.º 1
0
        public void DoSerialize()
        {
            ClassSerialization cs   = new ClassSerialization();
            FileStream         file = new FileStream("Demo.bin", FileMode.OpenOrCreate, FileAccess.Write);
            BinaryFormatter    bf   = new BinaryFormatter();

            bf.Serialize(file, cs);
            file.Close();
        }
Ejemplo n.º 2
0
        public void DoDeSerialize()
        {
            ClassSerialization cs   = new ClassSerialization();
            FileStream         file = new FileStream("Demo.bin", FileMode.Open, FileAccess.Read);
            BinaryFormatter    bf   = new BinaryFormatter();

            cs = (ClassSerialization)bf.Deserialize(file);
            Console.WriteLine(cs.name);
            file.Close();
        }