示例#1
0
 static void Main11(string[] args)
 {
     XmlSerializer xr =
         new XmlSerializer(typeof(Player));
     Player p1 = new Player("Sachin", 101, 120);
     FileStream fs = new FileStream
         ("myTime.xml", FileMode.Create);
     xr.Serialize(fs, p1);
     fs.Close();
 }
示例#2
0
 static void Main8(string[] args)
 {
     FileStream fs = new FileStream
         ("myPlayer", FileMode.Create);
     //Emp e1 = new Emp("AAAA", 101, 10000);
     Player p1 = new Player("sachin", 101, 120);
     BinaryFormatter bf = new BinaryFormatter();
     bf.Serialize(fs, p1);
     fs.Close();
 }