public static bool HasAttributeOfAttributeType(this EnumDeclarationSyntax enumDeclaration, Type attributeType) { if (attributeType == null) { throw new ArgumentNullException(nameof(attributeType)); } var attributeName = attributeType.Name.Replace("Attribute", string.Empty, StringComparison.Ordinal); return(enumDeclaration.Select <AttributeSyntax>().Any(x => attributeName.Equals(x.Name.ToString(), StringComparison.Ordinal))); }