XML TO Class

public static T ParseToClass<T>(this string xml) where T : class
        {
            try
            {
                if (!string.IsNullOrEmpty(xml) && !string.IsNullOrWhiteSpace(xml))
                {
                    XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
                    using (StringReader stringReader = new StringReader(xml))
                    {
                        return (T)xmlSerializer.Deserialize(stringReader);
                    }
                }
            }
            catch (Exception)
            {

            }
            return null;
        }
Example:
None

Description

Parse XML String to Class

Details

Double click on the code to select all.