How does attribute class inheritance work in C #? To clarify, I'm talking about the inheritance of the attribute classes themselves (i.e., Base classes System.Attributes), and not about any classes that have them as an attribute.
For some reason I cannot find anything on this (my searches always appear with a different meaning).
For example, if a has a class AttributeAthat extends System.Attribute:
Do I need to mark subclasses separately AttributeAwith [AttributeUsage()]. (Since System.AttributeUsageinheritance true, I donβt think I will.)
Will AllowMultiple=falsein AttributeUsageof AttributeAprevent me from having multiple subclasses AttributeAfor attributes?
EDIT:
Programmers can only read code.
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
class AttributeA
{ }
class AttributeB : AttributeA
{ }
class AttributeC : AttributeA
{ }
[AttributeB]
[AttributeC]
class Foo
{ }
It works?