Exemplo n.º 1
0
 public static void Write(Package package, string folderName)
 {
     XmlSerializer serializer = new XmlSerializer(package.GetType());
     using (StreamWriter writer = new StreamWriter(folderName))
     {
         serializer.Serialize(writer.BaseStream, package);
     }
 }
Exemplo n.º 2
0
 public static Package Read(Package package, string folderName)
 {
     XmlSerializer serializer = new XmlSerializer(package.GetType());
     using (StreamReader reader = new StreamReader(folderName))
     {
         object deserialized = serializer.Deserialize(reader.BaseStream);
         package = (Package)deserialized;
     }
     return package;
 }