How does inheritance of attribute classes work in C#? To clarify, I am talking about the inheritance of the attribute classes themselves (i.e. base classes of System.Attributes), NOT any classes that happen to have them as attribute.
For some reason, I cannot seem to find anything on this (my searches always turn up with the other meaning).
For example, if a have a class AttributeA which extends System.Attribute:
Do I have to separately mark subclasses of
AttributeAwith[AttributeUsage()]. (SinceSystem.AttributeUsage's inheritance istrue, I don't think I will.)Will
AllowMultiple=falseon theAttributeUsageofAttributeAprevent me from having multiple subclasses ofAttributeAfor attributes?
EDIT:
Programmers can only read code.
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
class AttributeA
{ }
class AttributeB : AttributeA
{ }
class AttributeC : AttributeA
{ }
[AttributeB]
[AttributeC]
class Foo
{ }
Does this work?