Attributes as a Language Extension Mechanism

Both the GetResource and GetKnownResources functions are prefixed by a special tag enclosed in angle brackets, <WebMethod()>. This tag is known as an attribute, and it is used as a language extension mechanism. In the example in the previous section, it tells the compiler that the two methods marked by the <WebMethod()> attribute are the ones the component will expose to the outside world, through the Web Services server. It is important to understand that attribute in this context is different from the UML concept of an attribute. It is a .NET-specific way to extend a language by adding special notations to some of its elements. This is the meaning that is attached to the attribute concept within ...

Get Visual Basic® .NET by Example 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.