public static void WriteXML(string name, string position) { Player qb = new Player(); qb.name = name; qb.position = System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(Player)); System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\y49592\Documents\Visual Studio 2013\Projects\fantasyapp\fantasyapp\Player.xml"); writer.Serialize(file, qb); file.Close(); }
public static string ReadXML() { System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(Player)); using (System.IO.StreamReader file = new System.IO.StreamReader(@"C:\Users\y49592\Documents\Visual Studio 2013\Projects\fantasyapp\fantasyapp\Player.xml")) { Player qb = new Player(); qb = (Player)reader.Deserialize(file); string result = qb.name; return result; } }