Regardless of the language being used, some aspects of the application can’t be expressed with plain executable statements. For example, each language offers its own way to define project level properties (name, version etc.). The .Net attributes solves these problems and offer a streamlined standardized way to associate additional information with specific pieces of code. In practice, attributes let us extend the metadata associated with with an assembly.
Attributes require System.ComponentModel. Attributes can not be referenced from code.
Example:
Imports System.ComponentModel
Public Class cAttributes
Get
''Code goes here
End Get
Set (ByVal value)
''Code goes here
End Set
End Property
End Class
Conditional Attributes:
#If Condifiton Then
Sub SubName ()
''Code goes here
End Sub
#End If
Or
Sub SubName()
''Code goes here
End Sub
Obsolete Attributes:
Note: This is just a reminder for programmers, this does not mean that the compiler will ignore this sub.
Sub SubName()
''Code goes here
End Sub
Links:
Attributes Programming in VB.NET
Add a comment