c# - Reflection - Access custom attributes by name -
i'm attempting see if given method decorated attribute, (the attribute in question nunit.framework.testattribute) need able check attribute regardless of version attribute is. currently, have nunit.framework.dll version 2.6.2 in project using reflection, , version 2.6.0 of dll in test. reflection not finding attribute.
is there way do
bool istest = method.getcustomattributes(typeof(testattribute), true).length > 0; without having access correct version of testattribute dll?
where method of type methodinfo.
you can attributes , filter name:
method.getcustomattributes(true) .where(a => a.gettype().fullname == "nunit.framework.testattribute");
Comments
Post a Comment