Moved another helper method that tests whether a type is carrying an attribute into the TypeHelper class

git-svn-id: file:///srv/devel/repo-conversion/nusu@271 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2012-03-08 17:14:42 +00:00
parent 97de199705
commit 0637b9d71b
4 changed files with 31 additions and 18 deletions

View file

@ -35,8 +35,8 @@ namespace Nuclex.Support.Plugins {
/// Tests whether the default consturctor of the no plugin attribute works
/// </summary>
[Test]
public void TestDefaultConstructor() {
new NoPluginAttribute();
public void HasDefaultConstructor() {
Assert.NotNull(new NoPluginAttribute());
}
}

View file

@ -86,8 +86,7 @@ namespace Nuclex.Support.Plugins {
}
// Types that have been tagged with the [NoPlugin] attribute will be ignored
object[] attributes = type.GetCustomAttributes(true);
if(containsNoPluginAttribute(attributes)) {
if(type.HasAttribute<NoPluginAttribute>()) {
continue;
}
@ -104,20 +103,6 @@ namespace Nuclex.Support.Plugins {
}
/// <summary>
/// Determines whether the specifies list of attributes contains a NoPluginAttribute
/// </summary>
/// <param name="attributes">List of attributes to check</param>
/// <returns>True if the list contained a NoPluginAttribute, false otherwise</returns>
private static bool containsNoPluginAttribute(object[] attributes) {
for(int index = 0; index < attributes.Length; ++index) {
if(attributes[index] is NoPluginAttribute) {
return true;
}
}
return false;
}
/// <summary>Reports an error to the debugging console</summary>
/// <param name="error">Error message that will be reported</param>
private static void reportError(string error) {