Reputation: 9911
Say I have a situation like so:
[MyAttribute]
public class MyClass
{
}
[AttributeUssage(AttributeTargets.Class)]
public class MyAttribute
{
public MyAttribute(String a_strName)
{
}
}
Is there anyway that within constructor of MyAttribute
I can know that the attribute is attached to MyClass
?
Upvotes: 1
Views: 37
Reputation: 1503839
No, I'm afraid not - attributes don't "know" what they're applied to.
Upvotes: 1