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

C# LANGUAGE SPECIFICATION

1o The function member implementation determined in the step above is invoked. The object

2referenced by E becomes the object referenced by this.

314.4.3.1 Invocations on boxed instances

4A function member implemented in a value-type can be invoked through a boxed instance of that value-type

5in the following situations:

6When the function member is an override of a method inherited from type object and is invoked

7through an instance expression of type object.

8When the function member is an implementation of an interface function member and is invoked

9through an instance expression of an interface-type.

10When the function member is invoked through a delegate.

11In these situations, the boxed instance is considered to contain a variable of the value-type, and this variable

12becomes the variable referenced by this within the function member invocation. [Note: In particular, this

13means that when a function member is invoked on a boxed instance, it is possible for the function member to

14modify the value contained in the boxed instance. end note]

1514.5 Primary expressions

16Primary expressions include the simplest forms of expressions.

17primary-expression:

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

array-creation-expression primary-no-array-creation-expression

primary-no-array-creation-expression: literal

simple-name parenthesized-expression member-access invocation-expression element-access this-access

base-access post-increment-expression post-decrement-expression object-creation-expression delegate-creation-expression typeof-expression checked-expression unchecked-expression default-value-expression anonymous-method-expression

38Primary expressions are divided between array-creation-expressions and primary-no-array-creation-

39expressions. Treating array-creation-expression in this way, rather than listing it along with the other simple

40expression forms, enables the grammar to disallow potentially confusing code such as

41object o = new int[3][1];

42which would otherwise be interpreted as

43object o = (new int[3])[1];

44A primary-expression is permitted to reference a static class (§17.1.1.3) if the primary-expression is the E in

45a member-access (§14.5.4) of the form E.I.

160

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