Esempio n. 1
0
        static void Main(string[] args)
        {
            Boing plane  = new Boing();
            Boing plane2 = new Boing();

            Boing[] planes = new Boing[] { plane, plane2 };

            plane.addInfo();
            plane2.addInfo();

            BinarySerialize(plane);
            BinaryDesirialaize();
            SOAPSerialize(plane);
            SOAPDeserialize();
            XMLSerialize(plane);
            XMLDeserialize();
            JSONSerialize(plane);
            JSONDeserialize();
            JSONArraySerialize(planes);
            JSONArrayDeserialize();
            XMLArraySerialize(planes);
            XMLArrayDeserialize();
            XPath();
            XmlLinq();
        }
Esempio n. 2
0
        static public void JSONDeserialize()
        {
            DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(Boing));

            using (FileStream fs = new FileStream("plane.json", FileMode.OpenOrCreate))
            {
                Boing plane = (Boing)json.ReadObject(fs);
                Console.Write("Объект Десериализован ");
                plane.Type();
            }
        }
Esempio n. 3
0
        static public void XMLDeserialize()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Boing));

            using (FileStream fs = new FileStream("plane.xml", FileMode.OpenOrCreate))
            {
                Boing plane = (Boing)serializer.Deserialize(fs);
                Console.Write("Объект Десериализован ");
                plane.Type();
            }
        }
Esempio n. 4
0
        static public void SOAPDeserialize()
        {
            SoapFormatter formatter = new SoapFormatter();

            using (FileStream fs = new FileStream("plane.soap", FileMode.OpenOrCreate))
            {
                Boing plane = (Boing)formatter.Deserialize(fs);

                Console.Write("Объект Десериализован ");
                plane.Type();
            }
        }
Esempio n. 5
0
        static public void BinaryDesirialaize()
        {
            BinaryFormatter formatter = new BinaryFormatter();

            using (FileStream fs = new FileStream("plane.dat", FileMode.OpenOrCreate))
            {
                Boing plane = (Boing)formatter.Deserialize(fs);

                Console.Write("Объект Десериализован ");
                plane.Type();
            }
        }