S
Steve
Is there a way to get the type information for the class an attribute is
defined on at runtime? I tried getting the attribute type, and then
checking the DeclaringType property but it was null.
Example:
[Cool]
public class Test {}
[AttributeUsage(AttributeTargets.Class)]
public class CoolAttribute : Attribute {
public CoolAttribute() {
Type implementingClass = this.GetType().someFunction;
//implementingClass should now be the Type information for Test
}
}
Surely there has to be a way to do this, and I just can't figure it out.
If it's not possible, can anyone explain why, and what the limitation is
that prevents this?
Thanks,
Steve
defined on at runtime? I tried getting the attribute type, and then
checking the DeclaringType property but it was null.
Example:
[Cool]
public class Test {}
[AttributeUsage(AttributeTargets.Class)]
public class CoolAttribute : Attribute {
public CoolAttribute() {
Type implementingClass = this.GetType().someFunction;
//implementingClass should now be the Type information for Test
}
}
Surely there has to be a way to do this, and I just can't figure it out.
If it's not possible, can anyone explain why, and what the limitation is
that prevents this?
Thanks,
Steve