BExIS.Xml.Helpers.XmlSchemaUtility.IsEnumerationType C# (CSharp) Method

IsEnumerationType() public static method

returns true if a simpletype is a restriction
public static IsEnumerationType ( XmlSchemaObject restrictionType ) : bool
restrictionType System.Xml.Schema.XmlSchemaObject
return bool
        public static bool IsEnumerationType(XmlSchemaObject restrictionType)
        {
            XmlSchemaObjectCollection facets = new XmlSchemaObjectCollection();

            if (restrictionType is XmlSchemaSimpleTypeRestriction)
                facets = ((XmlSchemaSimpleTypeRestriction)restrictionType).Facets;

            if (restrictionType is XmlSchemaSimpleContentRestriction)
                facets = ((XmlSchemaSimpleContentRestriction)restrictionType).Facets;

            foreach (XmlSchemaObject facet in facets)
            {
                if (facet is XmlSchemaEnumerationFacet) return true;
            }

            return false;
        }