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;
}