Esempio n. 1
0
        static void Main()
        {
            Paysage picture1 = new Paysage("is setting down", "firs", "jupms", "on a tree");
            // picture1.DrawPaysage();
            XmlSerializer Xser = new XmlSerializer(typeof(Paysage));

            using (FileStream ser = new FileStream("pic3.xml", FileMode.OpenOrCreate, FileAccess.Write)){
                Xser.Serialize(ser, picture1);
            }

            Paysage pictureFromPhoto;

            using (FileStream ser = new FileStream("pic3.xml", FileMode.Open, FileAccess.Read)){
                pictureFromPhoto = Xser.Deserialize(ser) as Paysage;
            }
            pictureFromPhoto.DrawPaysage();
        }
Esempio n. 2
0
        static void Main()
        {
            Paysage picture1 = new Paysage("is setting down", "firs", "jupms", "on a tree");
            // picture1.DrawPaysage();
            BinaryFormatter bin = new BinaryFormatter();

            using (FileStream ser = new FileStream("pic1.bin", FileMode.OpenOrCreate, FileAccess.Write)){
                bin.Serialize(ser, picture1);
            }

            Paysage pictureFromPhoto;

            using (FileStream ser = new FileStream("pic1.bin", FileMode.Open, FileAccess.Read)){
                pictureFromPhoto = bin.Deserialize(ser) as Paysage;
            }
            pictureFromPhoto.DrawPaysage();
        }