Created
October 13, 2019 12:18
-
-
Save Ganeshcse/13963e6974e8f82746d258bfd649c9bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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