Exemple #1
0
        private void BinaryFormatterReader()
        {
            BinaryFormatter formater = new BinaryFormatter();
            FileStream      stream   = new FileStream("nikhil.bak", FileMode.Open);
            var             obj      = formater.Deserialize(stream);

            DemoClass demo = obj as DemoClass;

            txtContents.Text = demo.ToString();
            stream.Close();
            stream.Dispose();
        }
Exemple #2
0
        private void XmlFormatterReader()
        {
            XmlSerializer formatter = new XmlSerializer(typeof(DemoClass));
            FileStream    stream    = new FileStream("nikhil.txt", FileMode.Open);
            var           obj       = formatter.Deserialize(stream);

            DemoClass demo = obj as DemoClass;

            txtContents.Text = demo.ToString();
            stream.Close();
            stream.Dispose();
        }