示例#1
0
 public static void SerializeXml(FruitsBasket fb, string fileName)
 {
     //XmlSerializer xmlFormat = new XmlSerializer(typeof(List<Fruit>));
     using (FileStream fileStream = new FileStream(fileName, FileMode.Create))
     {
         XmlSerializer serializer = new XmlSerializer(fb.GetType());
         serializer.Serialize(fileStream, fb);
         //xmlFormat.Serialize(fileStream, fruits);
     }
 }