Element access
An element-access consists of a primary-no-array-creation-expression, followed by a “[“ token, followed by an argument-list, followed by a “]” token. The argument-list consists of one or more arguments, separated by commas. element-access: The argument-list of an element-access is not allowed to contain ref or out arguments. An element-access is dynamically bound (§7.2.2) if at least one of the following holds:
In this case the compiler classifies the element-access as a value of type dynamic. The rules below to determine the meaning of the element-access are then applied at run-time, using the run-time type instead of the compile-time type of those of the primary-no-array-creation-expression and argument-list expressions which have the compile-time type dynamic. If the primary-no-array-creation-expression does not have compile-time type dynamic, then the element access undergoes a limited compile time check as described in §7.5.4. If the primary-no-array-creation-expression of an element-access is a value of an array-type, the element-access is an array access (§7.6.6.1). Otherwise, the primary-no-array-creation-expression must be a variable or value of a class, struct, or interface type that has one or more indexer members, in which case the element-access is an indexer access (§7.6.6.2).
|