Exemplo n.º 1
0
        public static void Test_xmlSerialize_02()
        {
            _tr.WriteLine("Test_xmlSerialize_02");
            Test_01 test = new Test_01()
            {
                id = 1, name = "toto"
            };

            XmlSerialize(test, "test_01_02.xml");
        }
Exemplo n.º 2
0
        public static void Test_xmlDeserialize_01()
        {
            _tr.WriteLine("Test_xmlDeserialize_01");
            XmlSerializer xs = new XmlSerializer(typeof(Test_01));

            using (StreamReader rd = new StreamReader("test_01_01.xml"))
            {
                Test_01 test = xs.Deserialize(rd) as Test_01;
                test.zView();
            }
        }
Exemplo n.º 3
0
        public static void Test_xmlSerialize_01()
        {
            _tr.WriteLine("Test_xmlSerialize_01");
            Test_01 test = new Test_01()
            {
                id = 1, name = "toto", addressType = AddressType.Bill | AddressType.Ship
            };
            XmlSerializer xs = new XmlSerializer(typeof(Test_01));

            using (StreamWriter wr = new StreamWriter("test_01_01.xml"))
            {
                xs.Serialize(wr, test);
            }
        }