public static async Task <RootDetalhe> GetItemDetalhe(int id) { string RPG_ITEM = $"thing?id={id}"; var xml = await GetURLContent(RPG_ITEM); RootDetalhe obj = new RootDetalhe(); using (TextReader reader = new StringReader(xml)) { try { obj = (RootDetalhe) new XmlSerializer(typeof(RootDetalhe)).Deserialize(reader); } catch (InvalidOperationException) { //XML inválido } } return(obj); }
public static async Task <DetalheItem> GetItemDetalhe(string id) { string RPG_ITEM = $"thing?id={id}"; var xml = await GetURLContent(RPG_ITEM); RootDetalhe resultado = new RootDetalhe(); using (TextReader reader = new StringReader(xml)) { try { resultado = (RootDetalhe) new XmlSerializer(typeof(RootDetalhe)).Deserialize(reader); resultado.Item.Descricao = System.Net.WebUtility.HtmlDecode(resultado.Item.Descricao); } catch (InvalidOperationException) { //XML inválido } } return(resultado.Item); }