Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vb.net

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

<Global.System.Serializable(),_  
 Global.System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")>
like image 694
Dayan Avatar asked Jul 05 '26 10:07

Dayan


1 Answers

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.

like image 51
Oded Avatar answered Jul 08 '26 13:07

Oded



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!