diff --git a/Source/TypeHelper.cs b/Source/TypeHelper.cs index 5778ee6..9a66272 100644 --- a/Source/TypeHelper.cs +++ b/Source/TypeHelper.cs @@ -163,7 +163,17 @@ namespace Nuclex.Support { /// /// True if the type has the specified attribute, otherwise false public static bool HasAttribute(this Type type) { - object[] attributes = type.GetCustomAttributes(typeof(TAttribute), true); + return type.HasAttribute(typeof(TAttribute)); + } + + /// Determines whether the type has the specified attribute + /// + /// Type that will be checked for presence of the specified attribute + /// + /// Attribute the type will be checked for + /// True if the type has the specified attribute, otherwise false + public static bool HasAttribute(this Type type, Type attributeType) { + object[] attributes = type.GetCustomAttributes(attributeType, true); return (attributes != null) && (attributes.Length > 0); }