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?
No, I’m afraid not – attributes don’t “know” what they’re applied to.