public void Reader() { infos inf = new infos(); XmlSerializer xmlsr = new XmlSerializer(inf.GetType()); File.Create("info.xml"); object disp = xmlsr.Deserialize(r); inf = (infos)disp; Console.WriteLine("Reading.."); highname = inf.names; highscore = inf.scores; r.Close(); }
public void writer() { r.Close(); infos inf = new infos(); Console.Clear(); Console.WriteLine("Error in reading records:\nEnter your name new user"); inf.names = Console.ReadLine(); inf.scores = 0; XmlSerializer xmlsr = new XmlSerializer(inf.GetType()); StreamWriter w = new StreamWriter("info.xml"); xmlsr.Serialize(w, inf); Console.WriteLine("Writing complete"); w.Flush(); w.Close(); }