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 DR(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(real, imag); SR(cn, Name); DR(cn, Name); }