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(); }
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(); }
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(); }