Skip to content

Instantly share code, notes, and snippets.

@Ganeshcse
Created October 13, 2019 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ganeshcse/13963e6974e8f82746d258bfd649c9bf to your computer and use it in GitHub Desktop.
Save Ganeshcse/13963e6974e8f82746d258bfd649c9bf to your computer and use it in GitHub Desktop.
System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(Response));
using (StringReader sr = new StringReader(categories))
{
var result = ser.Deserialize(sr);
}
[Serializable, XmlRoot("response")]
public class Response
{
public Data Data { get; set; }
public Response()
{
Data = new Data();
}
}
[Serializable]
public class Data
{
[XmlArray("categories")]
[XmlArrayItem("category", typeof(Category))]
public List<Category> Categories { get; set; }
public Data()
{
Categories = new List<Category>();
}
}
[Serializable]
public class Category
{
public string Id { get; set; }
public string Name { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment