XMLConverter.CreateWithType C# (CSharp) Method

CreateWithType() private static method

Adds a Type attribute an element.
private static CreateWithType ( System.Xml.Linq.XElement el, PropertyInfo prop ) : System.Xml.Linq.XElement
el System.Xml.Linq.XElement The property info.
prop PropertyInfo The input object.
return System.Xml.Linq.XElement
    private static XElement CreateWithType(XElement el, PropertyInfo prop)
    {
        XElement xel = new XElement(el);

        if (prop.PropertyType.IsEnum)
        {
            xel.Add(new XAttribute("Type", Enum.GetUnderlyingType(prop.PropertyType.UnderlyingSystemType).Name));
                    }
        else
        {
            xel.Add(new XAttribute("Type", prop.PropertyType.Name));
        }

        return xel;
    }