2.2 Identifiers
An identifier is a name. Visual Basic .NET identifiers conform to the Unicode Standard Annex 15 with one exception: identifiers may begin with an underscore (connector) character. If an identifier begins with an underscore, it must contain at least one other valid identifier character to disambiguate it from a line continuation.
Regular identifiers may not match keywords, but escaped identifiers can. An escaped identifier is an identifier delimited by square brackets. Escaped identifiers follow the same rules as regular identifiers except that they may match keywords and may not have type characters.
This example defines a class named class with a shared method named shared that takes a parameter named boolean and then calls the method.
Imports System
Class [class]
Shared Sub [shared](ByVal [boolean] As Boolean)
If [boolean] Then
Console.WriteLine("true")
Else
Console.WriteLine("false")
End If
End Sub
End Class
Module [module]
Sub Main()
[class].[shared](True)
End Sub
End Module
Identifiers are case insensitive, so two identifiers are considered to be the same identifier if they differ only in case.
Note The Unicode Standard one-to-one case mappings are used when comparing identifiers, and any locale-specific case mappings are ignored.
Identifier ::= NonEscapedIdentifier [ TypeCharacter ] | EscapedIdentifier NonEscapedIdentifier ::= < IdentifierName but not Keyword > EscapedIdentifier ::= [ IdentifierName ] IdentifierName ::= IdentifierStart [ IdentifierCharacter+ ] IdentifierStart ::= AlphaCharacter | UnderscoreCharacter IdentifierCharacter IdentifierCharacter ::= UnderscoreCharacter | AlphaCharacter | NumericCharacter | CombiningCharacter | FormattingCharacter AlphaCharacter ::= < Unicode alphabetic character (classes Lu, Ll, Lt, Lm, Lo, Nl) > NumericCharacter ::= < Unicode decimal digit character (class Nd) > CombiningCharacter ::= < Unicode combining character (classes Mn, Mc) > FormattingCharacter ::= < Unicode formatting character (class Cf) > UnderscoreCharacter ::= < Unicode connection character (class Pc) > IdentifierOrKeyword ::= Identifier | Keyword
See Also
2.1 Characters and Lines | 2.3 Keywords | 2.4 Literals | 2.5 Separators | 2.6 Operator Characters | 2. Lexical Grammar | Declared Element Names (Visual Basic Language Concepts)