예제 #1
0
파일: Program.cs 프로젝트: Nikitand/C-Labs-
        static void XMLDeserialize()
        {
            XmlSerializer deserialize = new XmlSerializer(typeof(Predator));

            using (FileStream fs = new FileStream("predator.xml", FileMode.OpenOrCreate))
            {
                Predator predator = (Predator)deserialize.Deserialize(fs);
                predator.Show();
                Console.WriteLine("XML десериализован");
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: Nikitand/C-Labs-
        static void SOAPDeserialize()
        {
            SoapFormatter formatter = new SoapFormatter();

            using (FileStream fs = new FileStream("predator.soap", FileMode.OpenOrCreate))
            {
                Predator predators = (Predator)formatter.Deserialize(fs);
                Console.WriteLine("Десериализован SOAP");
                predators.Show();
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: Nikitand/C-Labs-
        static void JsonDeserialize()
        {
            DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(Predator));

            using (FileStream fs = new FileStream("predator.json", FileMode.OpenOrCreate))
            {
                Predator predator = (Predator)json.ReadObject(fs);

                predator.Show();
                Console.WriteLine("Объект десериализован Json");
            }
        }