In C#, I am extracting the attribute data from a custom attribute named ImageAttribute like this:
var attrData = instruction.GetCustomAttributesData();
foreach (var a in attrData) {
if (a.AttributeType == typeof(ImageAttribute)) {
var args = a.ConstructorArguments;
nodeIcon = args[0].Value.ToString();
}
}
However, in some cases the [Image(typeof(MyIcon))] is on a parent class instead of the Instruction class (the type of “instruction”).
How can I make GetCustomAttributesData() also include attributes of parent classes?