public static void SerializeObject(string filename, Save obj) { using (Stream stream = File.Open(filename, FileMode.OpenOrCreate, FileAccess.Write)) { var formatter = new BinaryFormatter(); formatter.Serialize(stream, obj); } }
public void SaveSettings() { var file = new FileInfo("settings.db"); var data = new Save { A = Picker.Color.A, R = Picker.Color.R, G = Picker.Color.G, B = Picker.Color.B, Size = Size }; Save.SerializeObject(file.FullName, data); }