Applying an attribute multiple times

I had designed a custom attribute for fields and wanted to be able to apply it multiple times. For example:

<ExtItem("A1", "Text"), ExtItem("A2", "Color")> _
Private label1 As System.Windows.Forms.Label

This produced an error: Attribute 'ExtItem' cannot be applied multiple times. A quick check of the documentation says "multiple instances of an attribute can be applied to the same target element". So what was I doing wrong?

Fellow MVP Mattias Sjogren pointed me to the AttributesUsage attribute:
<AttributeUsage(..., AllowMultiple:=True)> _
Public Class ExtItemAttribute
    ...

Thanks Mattias!

1 Comment

Comments have been disabled for this content.