Dayan
Dayan

Reputation: 8031

What does < .... > Do in VB.NET?

What does the following code do? What is <...> notation?

<Global.System.Serializable(),_  
 Global.System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")>

Upvotes: 3

Views: 286

Answers (1)

Oded
Oded

Reputation: 499152

It is the notation for applying attributes.

Attributes provide a powerful method of associating metadata, or declarative information, with code (assemblies, types, methods, properties, and so forth). After an attribute is associated with a program entity, the attribute can be queried at run time by using a technique called reflection.

And:

Attributes can be placed on most any declaration, though a specific attribute might restrict the types of declarations on which it is valid. In C#, you specify an attribute by placing the name of the attribute, enclosed in square brackets ([]), above the declaration of the entity to which it applies. In Visual Basic, an attribute is enclosed in angle brackets (< >). It must appear immediately before the element to which it is applied, on the same line.


In your code, you are marking the type (or method or property) as serializable and that the XmlSchemaProviderAttribute for the type is set with "GetTypedTableSchema".

These two are metadata that helps with serializing the type.

Upvotes: 7

Related Questions