I have the following classes:
[Msg(Value = "YaaY")]
public class PersonContainer<T> where T : new()
{
...
}
public class HappyPerson
{
...
}
[Msg(Value = "NaaY")]
public class SadPerson
{
...
}
Using the following method I can get the attributes of the "PersonContainer":
public void GetMsgVals(object personContainer)
{
var info = personContainer.GetType();
var attributes = (MsgAttribute[])info.GetCustomAttributes(typeof(MsgAttribute), false);
var vals= attributes.Select(a => a.Value).ToArray();
}
However I only get the attribute of "PersonContainer" (which is "YaaY") how can I get the atrributes of T (HappyPerson [if any] or SadPerson["NaaY"])
at runtime without knowing what T is?