Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C-sharp language specification.2004.pdf
Скачиваний:
14
Добавлен:
23.08.2013
Размер:
2.55 Mб
Скачать

Chapter 14 Expressions

1up the inheritance chain until at least one applicable, accessible, non-override method declaration is found.

2Then perform overload resolution on the set of applicable, accessible, non-override methods declared in that

3type and invoke the method thus selected. end note]

414.5.5.2 Delegate invocations

5For a delegate invocation, the primary-expression of the invocation-expression shall be a value of a

6delegate-type. Furthermore, considering the delegate-type to be a function member with the same parameter

7list as the delegate-type, the delegate-type shall be applicable (§14.4.2.1) with respect to the argument-list of

8the invocation-expression.

9The run-time processing of a delegate invocation of the form D(A), where D is a primary-expression of a

10delegate-type and A is an optional argument-list, consists of the following steps:

11D is evaluated. If this evaluation causes an exception, no further steps are executed.

12The argument list A is evaluated. If this evaluation causes an exception, no further steps are executed.

13The value of D is checked to be valid. If the value of D is null, a

14System.NullReferenceException is thrown and no further steps are executed.

15Otherwise, D is a reference to a delegate instance. A function member invocation (§14.4.3) is performed

16on each callable entity referenced by the delegate. If invocation of a callable entity causes an exception,

17the remaining callable entities are not invoked. Otherwise, the return result of the invocation is the result

18returned from the last callable entity.

1914.5.6 Element access

20An element-access consists of a primary-no-array-creation-expression, followed by a “[“ token, followed

21by an expression-list, followed by a “]” token. The expression-list consists of one or more expressions,

22separated by commas.

23element-access:

24

primary-no-array-creation-expression [ expression-list ]

25

expression-list:

26

expression

27

expression-list , expression

28If the primary-no-array-creation-expression of an element-access is a value of an array-type, the element-

29access is an array access (§14.5.6.1). Otherwise, the primary-no-array-creation-expression shall be a

30variable or value of a class, struct, or interface type that has one or more indexer members, in which case the

31element-access is an indexer access (§14.5.6.2).

3214.5.6.1 Array access

33For an array access, the primary-no-array-creation-expression of the element-access shall be a value of an

34array-type. The number of expressions in the expression-list shall be the same as the rank of the array-type,

35and each expression shall be of type int, uint, long, ulong, or of a type that can be implicitly converted

36to one or more of these types.

37The result of evaluating an array access is a variable of the element type of the array, namely the array

38element selected by the value(s) of the expression(s) in the expression-list.

39The run-time processing of an array access of the form P[A], where P is a primary-no-array-creation-

40expression of an array-type and A is an expression-list, consists of the following steps:

41P is evaluated. If this evaluation causes an exception, no further steps are executed.

42The index expressions of the expression-list are evaluated in order, from left to right. Following

43evaluation of each index expression, an implicit conversion (§13.1) to one of the following types is

44performed: int, uint, long, ulong. The first type in this list for which an implicit conversion exists is

167

Соседние файлы в предмете Электротехника