Skip to main content

Posts

Showing posts from December, 2019

Convert Nested XML to C# class object and C# Class object to Nested XML File

Convert Nested XML to C# class object and C# Class object to Nested XML File Download Project Introduction In this Article we learn how to deserialize XML to C# objects and reverse from C# objects to XML files. In this article we will do practical with example with demo class and xml files. using System; using System.Collections; using System.IO; using System.Xml.Serialization; namespace TestApp {     public class Serializer     {              public T Deserialize<T>(string input) where T : class         {             System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(T));             using (StringReader sr = new StringReader(input))             {                 return (T)ser.Deserialize(sr);  ...