Пример #1
0
        static void Main(string[] args)
        {
            PayBill bill1 = new PayBill(12, 33, 23, 2);

            Console.WriteLine(bill1);
            PayBill.check = false;                        //public static property, to serialize counting fields - true , to not - false
            Console.WriteLine();

            SaveAsSoapFormater(bill1, "bill1.dat");
            ReadAsSoapFormater("bill1.dat");
        }
Пример #2
0
        static void ReadAsSoapFormater(string fileName)  // deserialization method
        {
            SoapFormatter sf     = new SoapFormatter();
            PayBill       result = null;

            using (Stream fStream = File.OpenRead(fileName))
            {
                result = (PayBill)sf.Deserialize(fStream);
            }
            Console.WriteLine("Deserialization OK!\n\n");
            Console.WriteLine(result);
        }