Applying Custom Attributes

The previous subsection discussed the definition of a custom attribute for assigning metadata to a class representing a basic text document. Code in Listing 48.2 implements the related Document class that is decorated with the DocumentPropertiesAttribute.

Listing 48.2 Applying Custom Attributes

image

When you apply an attribute, you can shorten its name by excluding the Attribute word in the identifier. For example, DocumentPropertiesAttribute can be shortened as DocumentProperties. The Visual Basic compiler correctly recognizes the identifier of an attribute. Then you must provide required arguments, respecting the data type. ...

Get Visual Basic® 2010 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.