Export (0) Print
Expand All

11.1 Expression Classifications

Visual Studio .NET 2003

Every expression is classified as one of the following:

  • A value. Every value has an associated type.
  • A variable. Every variable has an associated type, namely the declared type of the variable.
  • A namespace. An expression with this classification can only appear as the left side of a member access. In any other context, an expression classified as a namespace causes a compile-time error.
  • A type. An expression with this classification can only appear as the left side of a member access. In any other context, an expression classified as a type causes a compile-time error.
  • A method group, which is a set of methods overloaded on the same name. A method group may have an associated instance expression.
  • A method pointer, which represents the location of a method. A method pointer may have an associated instance expression.
  • A property group, which is a set of properties overloaded on the same name. A property group may have an associated instance expression.
  • A property access. Every property access has an associated type, namely the type of the property. A property access may have an associated instance expression.
  • An event access. Every event access has an associated type, namely the type of the event. An event access may have an associated instance expression. An event access may appear as the first argument of the RaiseEvent, AddHandler, and RemoveHandler statements. In any other context, an expression classified as an event access causes a compile-time error.
  • Void. This occurs when the expression is an invocation of a subroutine. An expression classified as void is only valid in the context of an invocation statement.

The final result of an expression is never a namespace, type, method group, or property group. Rather, as noted above, these categories of expressions are intermediate constructs that are only permitted in certain contexts.

See Also

4.8 Variables | 10.5 Event Statements | 11.1 Expression Classifications | Constants and Enumerations (Visual Basic Language Reference) | Constants and Enumerations (Visual Basic Language Concepts)

Show:
© 2015 Microsoft