Beispiel #1
0
        public static SumOf DeSerialize()
        {
            FileStream      fileStream      = new FileStream("DoSum.out", FileMode.Open);
            BinaryFormatter binaryFormatter = new BinaryFormatter();
            SumOf           retValue        = (SumOf)binaryFormatter.Deserialize(fileStream);

            fileStream.Close();
            return(retValue);
        }
Beispiel #2
0
        static void Main()
        {
            Console.WriteLine("Create first one with new...");
            SumOf app = new SumOf(1, 5);

            Console.WriteLine("Creating second one with deserialize...");
            SumOf newInstance = SumOf.DeSerialize();

            newInstance.DisplaySums();
        }