示例#1
0
        public static void Try2DeSerializeXML()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Class4SerializeXML));

            Class4SerializeXML obj2DeSer = null;

            using (FileStream fs = new FileStream("state2.xml", FileMode.Open, FileAccess.Read))
            {
                obj2DeSer = serializer.Deserialize(fs) as Class4SerializeXML;
            }
        }
示例#2
0
        public static void Try2SerializeXML()
        {
            Class4SerializeXML obj2Ser = new Class4SerializeXML()
            {
                Number = 10, Password = "******", Login = "******"
            };

            XmlSerializer serializer = new XmlSerializer(typeof(Class4SerializeXML));

            using (FileStream fs = new FileStream("state2.xml", FileMode.OpenOrCreate, FileAccess.Write))
            {
                serializer.Serialize(fs, obj2Ser);
            }
        }