Esempio n. 1
0
 public static StructurePerso _createObject()
 {
     XmlSerializer xs = new XmlSerializer(typeof(StructurePerso));
     using (StreamReader rd = new StreamReader("DataPlayer.xml"))
     {
         StructurePerso p = xs.Deserialize(rd) as StructurePerso;
         return p;
     }
 }
Esempio n. 2
0
        public static void _save(int id)
        {
            StructurePerso p = new StructurePerso
            {
                Id = id,
                LastName = "Dupond",
                FirstName = "Jean",
                Address = new Address
                {
                    Street = "1, rue du petit pont",
                    ZipCode = "75005",
                    City = "Paris",
                    Country = "France"
                }
            };

            XmlSerializer xs = new XmlSerializer(typeof(StructurePerso));
            using (StreamWriter wr = new StreamWriter("DataPlayer.xml"))
            {
                xs.Serialize(wr, p);
            }
        }