예제 #1
0
파일: Program.cs 프로젝트: tolegenovbt/PP2
        static void Save(ComplexNumbers cn, string filename)
        {
            FileStream    fs  = new FileStream(filename, FileMode.Create, FileAccess.Write);
            XmlSerializer xml = new XmlSerializer(typeof(ComplexNumbers));

            xml.Serialize(fs, cn);
            fs.Close();
        }
예제 #2
0
파일: Program.cs 프로젝트: tolegenovbt/PP2
        static ComplexNumbers Load(string filename)
        {
            FileStream     fs  = new FileStream(filename, FileMode.Open, FileAccess.Read);
            XmlSerializer  xml = new XmlSerializer(typeof(ComplexNumbers));
            ComplexNumbers cn  = xml.Deserialize(fs) as ComplexNumbers;

            fs.Close();
            return(cn);
        }
예제 #3
0
파일: Program.cs 프로젝트: tolegenovbt/PP2
        static void Main(string[] args)
        {
            string[]       s        = Console.ReadLine().Split();
            string         filename = "saveComplexNumbers.xml";
            ComplexNumbers ab       = new ComplexNumbers(int.Parse(s[0]), int.Parse(s[1]));

            Save(ab, filename);

            ComplexNumbers cn = Load(filename);

            Console.WriteLine(cn.GetData());
        }
예제 #4
0
파일: Program.cs 프로젝트: yersj/pp2
        public static void F1()
        {
            ComplexNumbers cn = new ComplexNumbers(); //according to the characteristics of class Mark we create  ;

            cn.PrintInfo();                           //this is a solution;
            cn.PrintFormula();                        //write in console formula


            FileStream    fs = new FileStream("cn.txt", FileMode.Create, FileAccess.Write);
            XmlSerializer xs = new XmlSerializer(typeof(ComplexNumbers));

            xs.Serialize(fs, cn);//serializing-it's to save ur condition to txt or xml file to network with others in the internet or e.t.c
            fs.Close();
        }