.net - Inheritance of C# attribute classes -


how inheritance of attribute classes work in c#? clarify, talking inheritance of attribute classes (i.e. base classes of system.attributes), not classes happen have them attribute.

for reason, cannot seem find on (my searches turn other meaning).

for example, if have class attributea extends system.attribute:

  1. do have separately mark subclasses of attributea [attributeusage()]. (since system.attributeusage's inheritance true, don't think will.)

  2. will allowmultiple=false on attributeusage of attributea prevent me having multiple subclasses of attributea attributes?

edit:

programmers can read code.

[attributeusage(attributetargets.class, allowmultiple=false)] class attributea { }  class attributeb : attributea { }  class attributec : attributea { }  [attributeb] [attributec] class foo { } 

does work?

you can control behavior using named parameter inherited attributeusageattribute.

[attributeusage(attributetargets.class, allowmultiple = false, inherited = false)] class attributea { }  class attributeb : attributea { }  class attributec : attributea { } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -