static void Save(ClassToSerialize classToSave) { FileStream file = File.Open("test.data", FileMode.Create); var serializer = new BinaryFormatter(); serializer.Serialize(file, classToSave); file.Close(); }
static void Main(string[] args) { var testClass = new ClassToSerialize { Test = "Hi" }; testClass.StartHistory(); Save(testClass); }