XMLConverter.GetArrayElement C# (CSharp) Method

GetArrayElement() private static method

Gets the array element.
private static GetArrayElement ( PropertyInfo info, Array input, bool includetype ) : System.Xml.Linq.XElement
info PropertyInfo The property info.
input Array The input object.
includetype bool
return System.Xml.Linq.XElement
    private static XElement GetArrayElement(PropertyInfo info, Array input, bool includetype)
    {
        var name = XmlConvert.EncodeName(info.Name);

        XElement rootElement = new XElement(name);

        var arrayCount = input.GetLength(0);

        for (int i = 0; i < arrayCount; i++)
        {
            var val = input.GetValue(i);
            XElement childElement;

            if (val.GetType().IsSimpleType())
            {
                childElement =   new XElement(name + "Child", val);
            }
            else
            {
                childElement =  ToXml(val, includetype);
            }

            rootElement.Add(childElement);
        }

        return rootElement;
    }