System.Xml.Schema.Datatype_List.CreateValueConverter C# (CSharp) Method

CreateValueConverter() private method

private CreateValueConverter ( XmlSchemaType schemaType ) : System.Xml.Schema.XmlValueConverter
schemaType XmlSchemaType
return System.Xml.Schema.XmlValueConverter
        internal override XmlValueConverter CreateValueConverter(XmlSchemaType schemaType)
        {
            XmlSchemaType listItemType = null;
            XmlSchemaSimpleType simpleType;
            XmlSchemaComplexType complexType;
            complexType = schemaType as XmlSchemaComplexType;

            if (complexType != null)
            {
                do
                {
                    simpleType = complexType.BaseXmlSchemaType as XmlSchemaSimpleType;
                    if (simpleType != null)
                    {
                        break;
                    }
                    complexType = complexType.BaseXmlSchemaType as XmlSchemaComplexType;
                } while (complexType != null && complexType != XmlSchemaComplexType.AnyType);
            }
            else
            {
                simpleType = schemaType as XmlSchemaSimpleType;
            }
            if (simpleType != null)
            {
                do
                {
                    XmlSchemaSimpleTypeList listType = simpleType.Content as XmlSchemaSimpleTypeList;
                    if (listType != null)
                    {
                        listItemType = listType.BaseItemType;
                        break;
                    }
                    simpleType = simpleType.BaseXmlSchemaType as XmlSchemaSimpleType;
                } while (simpleType != null && simpleType != DatatypeImplementation.AnySimpleType);
            }

            if (listItemType == null)
            { //Get built-in simple type for the typecode
                listItemType = DatatypeImplementation.GetSimpleTypeFromTypeCode(schemaType.Datatype.TypeCode);
            }

            return XmlListConverter.Create(listItemType.ValueConverter);
        }