I’m searching to how can I know inside an attribute definition if the class I apply the attribute to, has another attribute
Example:
[My1Attribute]
public class MyClass
{
[My2Attribute]
int aux{get;set;}
}
internal sealed class My1Attribute : Attribute
{
public My1Attribute
{
// How can I Know if 'MyClass' has My2Attribute applied ???
}
}
The attribute itself will not know about the class to which it’s attached. You will need to use some other service/helper function/whatever to pair them up.
However, you might find the following useful:
Edit: For finding attributes on member fields