//customized Serialization for BinaryFormatter ::Write operation public static void Main2() { FileStream fs = new FileStream("BinaryFor.dat",FileMode.Create); Time t5 = new Time(10,20,30); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs,t5); fs.Close(); }
//customized Serialization for SoapFormatter public static void Main1() { FileStream fs = new FileStream("XmlFormatter.xml", FileMode.Create); Time t5 = new Time(50, 100, 150); SoapFormatter bf = new SoapFormatter(); bf.Serialize(fs, t5); fs.Close(); }