示例#1
0
        static void Save(ClassToSerialize classToSave)
        {
            FileStream file       = File.Open("test.data", FileMode.Create);
            var        serializer = new BinaryFormatter();

            serializer.Serialize(file, classToSave);
            file.Close();
        }
示例#2
0
        static void Main(string[] args)
        {
            var testClass = new ClassToSerialize {
                Test = "Hi"
            };

            testClass.StartHistory();
            Save(testClass);
        }