Identifiers
Identifiers
are names given to namespaces (discussed later in this chapter),
types (enumerations, structures, classes, standard modules,
interfaces, and delegates), type members (methods, constructors,
events, constants, fields, and properties), and variables.
Identifiers must begin with either an alphabetic or underscore
character ( _
), may be of
any length, and after the first character must consist of only
alphanumeric and underscore characters. Namespace declarations may be
declared either with identifiers or qualified identifiers
. Qualified identifiers consist of
two or more identifiers connected with the dot character (
.
). Only
namespace declarations may use qualified identifiers.
Consider this code fragment:
Imports System
Namespace ORelly.ProgVBNet
Public Class Hello
Public Shared Sub SayHello( )
Console.WriteLine("hello, world")
End Sub
End Class
End NamespaceThis code fragment declares three identifiers: OReilly.ProgVBNet (a namespace name), Hello (a class name), and SayHello (a method name). In addition to these, the code fragment uses three identifiers declared elsewhere: System (a namespace name), Console (a class name), and WriteLine (a method name).
Although Visual Basic .NET is not case sensitive, the case of identifiers is preserved when applications are compiled. When using Visual Basic .NET components from case-sensitive languages, the caller must use the appropriate case.
Ordinarily, identifiers may not match Visual Basic .NET keywords. If ...