Coding Custom Attributes

A custom attribute is a class that inherits, directly or indirectly, from System.Attribute. When coding custom attributes, the class name should end with the Attribute word. This is not mandatory but, besides being required by Microsoft’s Common Language Specification (CLS), it provides a better way for identifying attributes in code. When applying attributes, you can shorten the attribute names by excluding the Attribute word. For example, imagine you have a Document class representing a simple text document. You might want to provide further information on the document, such as the author, reviewer, or last edit date. This information can be provided and stored in the assembly metadata using a custom attribute. Code ...

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.