Generating a custom attribute using 'AttributeUsage(...)'
AttributeUsage(Inherited = True, AllowMultiple = True) internal class CustomMarkerAttribute(string Tag) : Attribute { public string Tag { get; } = Tag; }
Setting this attribute on a sample base class
[CustomMarker("Base Tag")] class BaseClass { }
Setting this attribute on a sample sub class
[CustomMarker("Sub Tag")] class SubClass { }
Reading the attributes of the sub class with 'Attribute.GetCustomAttributes(...)'
returns both the attribute set on the sub class and the attribute set on the base class.
Sub Tag Base Tag