This documentation is archived and is not being maintained.

7.5.5 Invocation expressions

Visual Studio .NET 2003

An invocation-expression is used to invoke a method.

primary-expression   (   argument-listopt   )

The primary-expression of an invocation-expression must be a method group or a value of a delegate-type. If the primary-expression is a method group, the invocation-expression is a method invocation (Section If the primary-expression is a value of a delegate-type, the invocation-expression is a delegate invocation (Section If the primary-expression is neither a method group nor a value of a delegate-type, a compile-time error occurs.

The optional argument-list (Section 7.4.1) provides values or variable references for the parameters of the method.

The result of evaluating an invocation-expression is classified as follows:

  • If the invocation-expression invokes a method or delegate that returns void, the result is nothing. An expression that is classified as nothing cannot be an operand of any operator, and is permitted only in the context of a statement-expression (Section 8.6).
  • Otherwise, the result is a value of the type returned by the method or delegate.