Пример #1
0
        public static void SR(ComplexNum cn, string Name) // функция для серелизаций
        {
            FileStream    fs = new FileStream(Name, FileMode.OpenOrCreate, FileAccess.ReadWrite);
            XmlSerializer sr = new XmlSerializer(typeof(ComplexNum));

            sr.Serialize(fs, cn);
            fs.Close();
        }
Пример #2
0
        public static void DS(ComplexNum cn, string Name)//функция для десерелизаций
        {
            FileStream    fs = new FileStream(Name, FileMode.OpenOrCreate, FileAccess.ReadWrite);
            XmlSerializer dr = new XmlSerializer(typeof(ComplexNum));

            cn = dr.Deserialize(fs) as ComplexNum;
            Console.WriteLine(cn);
            fs.Close();
        }
Пример #3
0
        static void Main(string[] args)
        {
            string complex = Console.ReadLine();
            string Name    = Console.ReadLine();

            GetParts(complex);

            ComplexNum cn = new ComplexNum(imagNum, realNum);

            SR(cn, Name);
            DS(cn, Name);
            Console.ReadKey();
        }