public XmlSports Deserialize(string xmlFeed) { XmlSports sports = null; System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(XmlSports)); StringReader reader = new StringReader(xmlFeed); using (reader) { sports = (XmlSports)serializer.Deserialize(reader); reader.Close(); } return(sports); }
public XmlSport GetExternalData(string url) { XmlSports xmlSports = null; try { XmlSerializer deserializer = new XmlSerializer(typeof(XmlSports)); StreamReader reader = new StreamReader(WebRequest.Create(url).GetResponse().GetResponseStream()); xmlSports = (XmlSports)deserializer.Deserialize(reader); reader.Close(); } catch (Exception) { //log return(null); } return(xmlSports.Sport); }