예제 #1
0
 public static void Save(Window window, string file)
 {
     using (FileStream stream = new FileStream(file, FileMode.Create))
     {
         BinaryFormatter formatter = new BinaryFormatter();
         WindowSettings settings = new WindowSettings();
         settings.AssignFrom(window);
         formatter.AssemblyFormat = FormatterAssemblyStyle.Simple;
         formatter.Serialize(stream, settings);
         stream.Close();
     }
 }
예제 #2
0
        public static void Save(Window window, Stream stream)
        {
            if (stream == null) throw new ArgumentNullException("stream");
            WindowSettings settings = new WindowSettings();
            settings.AssignFrom(window);

            XmlSerializer serializer = new XmlSerializer(typeof (WindowSettings));
            serializer.Serialize(stream, settings);
        }