It's possible to obtain a reference of the object that use an attribute?
E.g.:
public class Test {
[MyAttribute]
public string P {get;set;}
}
var k = new Test();
public class MyAttribute : Attribute
{
public void Invoke(){
//Can I get here a reference to k at runtime?
}
}
With [CallerMemberName]
I can know which property calls the attribute but I don't know how to get the caller itself.