I have a generic class which needs to use the name of one of its type arguments in a class attribute. I don't know how to access the class name in that context
I've tried using typeof(TMsg).Name
but VS shows an error saying
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
Currently my code looks like this:
[MessageBase(typeof(TMsg).Name)]
public abstract class DDSMessageAbstract<TMsg/*, TReader, TWriter, TMsgBase, TSupport*/> : MessageBaseForDDS
where TMsg : new()
...
My question is, is there a way for me to use the actual name of TMsg
or must I define this attribute for each inheriting class?