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

 

C# LANGUAGE SPECIFICATION

1

conversion-operator-declarator:

2

implicit operator type ( type identifier )

3

explicit operator type ( type identifier )

4

operator-body:

5

block

6;

7constructor-declaration:

8

attributesopt constructor-modifiersopt constructor-declarator constructor-body

9

constructor-modifiers:

10

constructor-modifier

11

constructor-modifiers constructor-modifier

12

constructor-modifier:

13

public

14

protected

15

internal

16

private

17extern

18constructor-declarator:

19

identifier ( formal-parameter-listopt ) constructor-initializeropt

20

constructor-initializer:

21

: base ( argument-listopt )

22

: this ( argument-listopt )

23

constructor-body:

24

block

25;

26static-constructor-declaration:

27

attributesopt static-constructor-modifiers identifier ( ) static-constructor-body

28

static-constructor-modifiers:

29

externopt static

30static externopt

31static-constructor-body:

32

block

33;

34destructor-declaration:

35

attributesopt externopt ~ identifier ( ) destructor-body

36

destructor-body:

37

block

38;

39A.2.7 Structs

40struct-declaration:

41

attributesopt struct-modifiersopt partialopt struct identifier type-parameter-listopt

42

struct-interfacesopt type-parameter-constraints-clausesopt struct-body ;opt

43

struct-modifiers:

44

struct-modifier

45

struct-modifiers struct-modifier

454

Annex A Grammar

1

struct-modifier:

2

new

3

public

4

protected

5

internal

6private

7struct-interfaces:

8: interface-type-list

9struct-body:

10{ struct-member-declarationsopt }

11struct-member-declarations:

12

struct-member-declaration

13

struct-member-declarations struct-member-declaration

14

struct-member-declaration:

15

constant-declaration

16

field-declaration

17

method-declaration

18

property-declaration

19

event-declaration

20

indexer-declaration

21

operator-declaration

22

constructor-declaration

23

static-constructor-declaration

24

type-declaration

25A.2.8 Arrays

26array-type:

27

non-array-type rank-specifiers

28

non-array-type:

29

type

30

rank-specifiers:

31

rank-specifier

32

rank-specifiers rank-specifier

33

rank-specifier:

34

[ dim-separatorsopt ]

35

dim-separators:

36

,

37

dim-separators ,

38

array-initializer:

39

{ variable-initializer-listopt }

40

{ variable-initializer-list , }

41

variable-initializer-list:

42

variable-initializer

43

variable-initializer-list , variable-initializer

44

variable-initializer:

45

expression

46

array-initializer

455

C# LANGUAGE SPECIFICATION

1A.2.9 Interfaces

2interface-declaration:

3

attributesopt interface-modifiersopt partialopt interface identifier type-parameter-listopt

4

interface-baseopt type-parameter-constraints-clausesopt interface-body ;opt

5

interface-modifiers:

6

interface-modifier

7

interface-modifiers interface-modifier

8

interface-modifier:

9

new

10

public

11

protected

12

internal

13private

14interface-base:

15: interface-type-list

16interface-body:

17{ interface-member-declarationsopt }

18interface-member-declarations:

19

interface-member-declaration

 

20

interface-member-declarations interface-member-declaration

21

interface-member-declaration:

 

22

interface-method-declaration

 

23

interface-property-declaration

 

24

interface-event-declaration

 

25

interface-indexer-declaration

 

26

interface-method-declaration:

 

27

attributesopt

newopt return-type

identifier type-parameter-listopt

28

( formal-parameter-listopt ) type-parameter-constraints-clausesopt ;

29

interface-property-declaration:

 

30

attributesopt newopt type identifier { interface-accessors }

31

interface-accessors:

 

 

32

attributesopt

get

;

 

33

attributesopt

set

;

 

34

attributesopt get ; attributesopt set ;

35

attributesopt set ; attributesopt get ;

36

interface-event-declaration:

 

37

attributesopt newopt event type identifier ;

38

interface-indexer-declaration:

 

39

attributesopt

newopt type this

[ formal-parameter-list ] { interface-accessors }

40A.2.10 Enums

41enum-declaration:

42

attributesopt enum-modifiersopt enum identifier enum-baseopt enum-body ;opt

43 enum-base:

44: integral-type

45enum-body:

46

{

enum-member-declarationsopt }

47

{

enum-member-declarations , }

456

Annex A Grammar

1

enum-modifiers:

2

enum-modifier

3

enum-modifiers enum-modifier

4

enum-modifier:

5

new

6

public

7

protected

8

internal

9private

10enum-member-declarations:

11

enum-member-declaration

12

enum-member-declarations , enum-member-declaration

13

enum-member-declaration:

14

attributesopt

identifier

15

attributesopt

identifier = constant-expression

16A.2.11 Delegates

17delegate-declaration:

18

attributesopt delegate-modifiersopt delegate return-type identifier type-parameter-listopt

19

( formal-parameter-listopt ) type-parameter-constraints-clausesopt ;

20

delegate-modifiers:

21

delegate-modifier

22

delegate-modifiers delegate-modifier

23

delegate-modifier:

24

new

25

public

26

protected

27

internal

28private

29A.2.12 Attributes

30global-attributes:

31

global-attribute-sections

32

global-attribute-sections:

33

global-attribute-section

34

global-attribute-sections global-attribute-section

35

global-attribute-section:

36

[ global-attribute-target-specifier attribute-list ]

37

[ global-attribute-target-specifier attribute-list , ]

38

global-attribute-target-specifier:

39

global-attribute-target :

40

global-attribute-target:

41

identifier

42

keyword

43

attributes:

44

attribute-sections

45

attribute-sections:

46

attribute-section

47

attribute-sections attribute-section

457

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