Applying Attributes Multiple Times

According to the particular nature of your custom attributes, you can decide whether multiple instances can be applied to programming elements. This is accomplished by setting the AllowMultiple property as True in the AttributeUsage. The following is an example:

<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Property,                AllowMultiple:=True)>Public Class DocumentPropertiesAttribute    Inherits Attribute

AllowMultiple is optional and thus is invoked as a named parameter. The following is an example of how you apply multiple instances of an attribute:

<DocumentProperties("Alessandro Del Sole",                    "Stephen Green")> ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.