Invocation expressions
An invocation-expression is used to invoke a method. invocation-expression: An invocation-expression is dynamically bound (§7.2.2) if at least one of the following holds:
In this case the compiler classifies the invocation-expression as a value of type dynamic. The rules below to determine the meaning of the invocation-expression are then applied at run-time, using the run-time type instead of the compile-time type of those of the primary-expression and arguments which have the compile-time type dynamic. If the primary-expression does not have compile-time type dynamic, then the method invocation undergoes a limited compile time check as described in §7.5.4. 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 (§7.6.5.1). If the primary-expression is a value of a delegate-type, the invocation-expression is a delegate invocation (§7.6.5.3). If the primary-expression is neither a method group nor a value of a delegate-type, a binding-time error occurs. The optional argument-list (§7.5.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 is permitted only in the context of a statement-expression (§8.6) or as the body of a lambda-expression (§7.15). Otherwise a binding-time error occurs. · Otherwise, the result is a value of the type returned by the method or delegate.
|