C# 语言规范 (MSDN)

此附录是主文档中描述的词法和语法以及不安全代码的语法扩展的摘要。这里,各语法产生式是按它们在主文档中出现的顺序列出的。

C.1 词法

input:(输入:)
input-sectionopt(输入节 可选
input-section:(输入节:)
input-section-part(输入节部分)
input-section   input-section-part(输入节   输入节部分)
input-section-part:(输入节部分:)
input-elementsopt   new-line(输入元素 可选   新行)
pp-directive(pp 指令)
input-elements:(输入元素:)
input-element(输入元素)
input-elements   input-element(输入元素   输入元素)
input-element:(输入元素:)
whitespace(空白)
comment(注释)
token(标记)

C.1.1 行结束符

new-line:(新行:)
回车符 (U+000D)
换行符 (U+000A)
回车符 (U+000D) 后跟换行符 (U+000A)
行分隔符 (U+2028)
段落分隔符 (U+2029)

C.1.2 空白

whitespace:(空白:)
任何含 Unicode 类 Zs 的字符
水平制表符 (U+0009)
垂直制表符 (U+000B)
换页符 (U+000C)

C.1.3 注释

comment:(注释:)
single-line-comment(单行注释)
delimited-comment(带分隔符的注释)
single-line-comment:(单行注释:)
//    input-charactersopt(//   输入字符 可选
input-characters:(输入字符:)
input-character(输入字符)
input-characters   input-character(输入字符   输入字符)
input-character:(输入字符:)
除换行符外的任何 Unicode 字符
new-line-character:(换行符:)
回车符 (U+000D)
换行符 (U+000A)
行分隔符 (U+2028)
段落分隔符 (U+2029)
delimited-comment:(带分隔符的注释:)
/*    delimited-comment-charactersopt   */(/*   带分隔符的注释字符 可选   */)
delimited-comment-characters:(带分隔符的注释字符:)
delimited-comment-character(带分隔符的注释字符)
delimited-comment-characters   delimited-comment-character(带分隔符的注释字符   带分隔符的注释字符)
delimited-comment-character:(带分隔符的注释字符:)
not-asterisk(非星号)
*   not-slash(*   非斜杠)
not-asterisk:(非星号:)
除 * 外的任何 Unicode 字符
not-slash:(非斜杠:)
除 / 外的任何 Unicode 字符

C.1.4 标记

token:(标记:)
identifier(标识符)
keyword(关键字)
integer-literal(整数)
real-literal(实数)
character-literal(字符)
string-literal(字符串)
operator-or-punctuator(运算符或标点)

C.1.5 Unicode 字符转义序列

unicode-escape-sequence:(unicode 转义序列:)
/u    hex-digit   hex-digit   hex-digit   hex-digit(/u   十六进制数字   十六进制数字   十六进制数字   十六进制数字)
/U    hex-digit   hex-digit   hex-digit   hex-digit   hex-digit   hex-digit   hex-digit   hex-digit(/U   十六进制数字   十六进制数字   十六进制数字   十六进制数字   十六进制数字   十六进制数字   十六进制数字   十六进制数字)

C.1.6 标识符

identifier:(标识符:)
available-identifier(可用的标识符)
@    identifier-or-keyword(@   标识符或关键字)
available-identifier:(可用的标识符:)
不是“关键字”的“标识符或关键字”
identifier-or-keyword:(标识符或关键字:)
identifier-start-character   identifier-part-charactersopt(标识符开始字符   标识符部分字符可选)
identifier-start-character:(标识符开始字符:)
letter-character(字母字符)
_ (the underscore character U+005F)(下划线字符 U+005F)
identifier-part-characters:(标识符部分字符:)
identifier-part-character(标识符部分字符)
identifier-part-characters   identifier-part-character(标识符部分字符   标识符部分字符)
identifier-part-character:(标识符部分字符:)
letter-character(字母字符)
decimal-digit-character(十进制数字字符)
connecting-character(连接字符)
combining-character(组合字符)
formatting-character(格式设置字符)
letter-character:(字母字符:)
类 Lu、Ll、Lt、Lm、Lo 或 Nl 的 Unicode 字符
表示类 Lu、Ll、Lt、Lm、Lo 或 Nl 的字符的 unicode 转义序列
combining-character:(组合字符:)
类 Mn 或 Mc 的 Unicode 字符
表示类 Mn 或 Mc 的字符的 unicode 转义序列
decimal-digit-character:(十进制数字字符:)
类 Nd 的 Unicode 字符
表示类 Nd 的字符的 unicode 转义序列
connecting-character:(连接字符:)
类 Pc 的 Unicode 字符
表示类 Pc 的字符的 unicode 转义序列
formatting-character:(格式设置字符:)
类 Cf 的 Unicode 字符
表示类 Cf 的字符的 unicode 转义序列

C.1.7 关键字

keyword: one of(关键字:下列之一)
abstractasbaseboolbreakbytecase
catchcharcheckedclassconstcontinuedecimal
defaultdelegatedodoubleelseenumevent
explicitexternfalsefinallyfixedfloatfor
foreachgotoifimplicitinintinterface
internalislocklongnamespacenewnull
objectoperatoroutoverrideparamsprivateprotected
publicreadonlyrefreturnsbytesealedshort
sizeofstackallocstaticstringstructswitchthis
throwtruetrytypeofuintulongunchecked
unsafeushortusingvirtualvoidvolatilewhile

C.1.8 文本

literal:(文本:)
boolean-literal(布尔值)
integer-literal(整数)
real-literal(实数)
character-literal(字符)
string-literal(字符串)
null-literal(空值)
boolean-literal:(布尔值:)
true
false
integer-literal:(整数:)
decimal-integer-literal(十进制整数)
hexadecimal-integer-literal(十六进制整数)
decimal-integer-literal:(十进制整数:)
decimal-digits   integer-type-suffixopt(十进制数字   整数类型后缀可选)
decimal-digits:(十进制数字:)
decimal-digit(十进制数字)
decimal-digits   decimal-digit(十进制数字   十进制数字)
decimal-digit: one of(十进制数字:下列之一)
0 1 2 3 4 5 6 7 8 9
integer-type-suffix: one of(整数类型后缀:下列之一)
U u L l UL Ul uL ul LU Lu lU lu
hexadecimal-integer-literal:(十六进制整数:)
0x    hex-digits   integer-type-suffixopt(0x   十六进制数字    整型后缀可选)
0X    hex-digits   integer-type-suffixopt(0X   十六进制数字    整型后缀可选)
hex-digits:(十六进制数字:)
hex-digit(十六进制数字)
hex-digits   hex-digit(十六进制数字   十六进制数字)
hex-digit: one of(十六进制数字:下列之一)
0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
real-literal:(实数:)
decimal-digits   .    decimal-digits   exponent-partopt   real-type-suffixopt(十进制数字   .   十进制数字   指数部分可选   实数类型后缀可选)
.    decimal-digits   exponent-partopt   real-type-suffixopt(.   十进制数字   指数部分可选   实数类型后缀可选)
decimal-digits   exponent-part   real-type-suffixopt(十进制数字   指数部分   实数类型后缀可选)
decimal-digits   real-type-suffix(十进制数字   实数类型后缀)
exponent-part:(指数部分:)
e    signopt   decimal-digits(e   符号 可选   十进制数字)
E    signopt   decimal-digits(E   符号 可选   十进制数字)
sign: one of(符号:下列之一)
+ -
real-type-suffix: one of(实数类型后缀:下列之一)
F f D d M m
character-literal:(字符:)
'    character   '('   字符   ')
character:(字符:)
single-character(单字符)
simple-escape-sequence(简单转义序列)
hexadecimal-escape-sequence(十六进制转义序列)
unicode-escape-sequence(unicode 转义序列)
single-character:(单字符:)
除 ' (U+0027)、/ (U+005C) 和换行符外的任何字符
simple-escape-sequence: one of(简单转义序列:下列之一)
/' /" // /0 /a /b /f /n /r /t /v
hexadecimal-escape-sequence:(十六进制转义序列:)
/x    hex-digit   hex-digitopt   hex-digitopt   hex-digitopt(/x   十六进制数字   十六进制数字 可选   十六进制数字 可选   十六进制数字 可选
string-literal:(字符串:)
regular-string-literal(规则字符串)
verbatim-string-literal(逐字的字符串)
regular-string-literal:(规则字符串:)
"    regular-string-literal-charactersopt   "("   规则字符串字符 可选   ")
regular-string-literal-characters:(规则字符串字符:)
regular-string-literal-character(规则字符串字符)
regular-string-literal-characters   regular-string-literal-character(规则字符串字符   规则字符串字符)
regular-string-literal-character:(规则字符串字符:)
single-regular-string-literal-character(单个规则字符串字符)
simple-escape-sequence(简单转义序列)
hexadecimal-escape-sequence(十六进制转义序列)
unicode-escape-sequence(unicode 转义序列)
single-regular-string-literal-character:(单个规则字符串字符:)
除 " (U+0022)、/ (U+005C) 和换行符外的任何字符
verbatim-string-literal:(逐字的字符串:)
@"    verbatim -string-literal-charactersopt   "(@"   逐字的字符串字符 可选   ")
verbatim-string-literal-characters:(逐字的字符串字符:)
verbatim-string-literal-character(逐字的字符串字符)
verbatim-string-literal-characters   verbatim-string-literal-character(逐字的字符串字符   逐字的字符串字符)
verbatim-string-literal-character:(逐字的字符串字符:)
single-verbatim-string-literal-character(单个逐字的字符串字符)
quote-escape-sequence(引号转义序列)
single-verbatim-string-literal-character:(单个逐字的字符串字符:)
除 " 外的任何字符
quote-escape-sequence:(引号转义序列:)
""
null-literal:(空文本:)
null

C.1.9 运算符和标点符号

operator-or-punctuator:(运算符或标点符号:下列之一)
{ } [ ] ( ) . , : ;
+ - * / % & | ^ ! ~
= < > ? ++ -- && || << >>
== != <= >= += -= *= /= %= &=
| = ^= <<= >>= ->

C.1.10 预处理指令

pp-directive:(pp 指令:)
pp-declaration(pp 声明)
pp-conditional(pp 条件)
pp-line(pp 行)
pp-diagnostic(pp 诊断)
pp-region(pp 区域)
pp-new-line:(pp 新行:)
whitespaceopt   single-line-commentopt   new-line(空白可选    单行注释可选    新行)
conditional-symbol:(条件符号:)
除 true 和 false 外的任何标识符或关键字
pp-expression:(pp 表达式:)
whitespaceopt   pp-or-expression   whitespaceopt(空白可选    pp 或表达式   空白可选)
pp-or-expression:(pp 或表达式:)
pp-and-expression(pp 与表达式)
pp-or-expression   whitespaceopt   ||     whitespaceopt   pp-and-expression(pp 或表达式   空白 可选   ||   空白 可选   pp 与表达式)
pp-and-expression:(pp 与表达式:)
pp-equality-expression(pp 相等表达式)
pp-and-expression   whitespaceopt   &&    whitespaceopt   pp-equality-expression(pp 与表达式   空白 可选   &&   空白 可选   pp 相等表达式)
pp-equality-expression:(pp 相等表达式:)
pp-unary-expression(pp 一元表达式)
pp-equality-expression   whitespaceopt   ==    whitespaceopt   pp-unary-expression(pp 相等表达式   空白 可选   ==   空白 可选   pp 一元表达式)
pp-equality-expression   whitespaceopt   !=    whitespaceopt   pp-unary-expression(pp 相等表达式   空白 可选   !=   空白 可选   pp 一元表达式)
pp-unary-expression:(pp 一元表达式:)
pp-primary-expression(pp 基本表达式)
!    whitespaceopt   pp-unary-expression(!   空白 可选   pp 一元表达式)
pp-primary-expression:(pp 基本表达式:)
true
false
conditional-symbol(条件符号)
(    whitespaceopt   pp-expression   whitespaceopt   )((空白 可选   pp 表达式   空白 可选   ))
pp-declaration:(pp 声明:)
whitespaceopt   #    whitespaceopt   define    whitespace   conditional-symbol   pp-new-line(空白可选    #   空白可选    define   空白    条件符号    pp 新行)
whitespaceopt   #    whitespaceopt   undef    whitespace   conditional-symbol   pp-new-line(空白可选    #   空白可选    undef   空白    条件符号    pp 新行)
pp-conditional:(pp 条件:)
pp-if-section   pp-elif-sectionsopt   pp-else-sectionopt   pp-endif(pp if 节   pp elif 节可选    pp else 节可选    pp endif)
pp-if-section:(pp if 节:)
whitespaceopt   #    whitespaceopt   if    whitespace   pp-expression   pp-new-line   conditional-sectionopt(空白可选    #   空白可选    if   空白    pp 表达式    pp 新行    条件节可选)
pp-elif-sections:(pp elif 节:)
pp-elif-section(pp elif 节)
pp-elif-sections   pp-elif-section(pp elif 节   pp elif 节)
pp-elif-section:(pp elif 节:)
whitespaceopt   #    whitespaceopt   elif    whitespace   pp-expression   pp-new-line   conditional-sectionopt(空白可选    #   空白可选    elif   空白    pp 表达式    pp 新行    条件节可选)
pp-else-section:(pp else 节:)
whitespaceopt   #    whitespaceopt   else    pp-new-line   conditional-sectionopt(空白可选    #   空白可选    else   pp 新行    条件节可选)
pp-endif:
whitespaceopt   #    whitespaceopt   endif    pp-new-line(空白 可选   #   空白 可选   endif   pp 新行)
conditional-section:(条件节:)
input-section(输入节)
skipped-section(跳过节)
skipped-section:(跳过节:)
skipped-section-part(跳过节部分)
skipped-section   skipped-section-part(跳过节   跳过节部分)
skipped-section-part:(跳过节部分:)
skipped-charactersopt   new-line(跳过字符 可选   新行)
pp-directive(pp 指令)
skipped-characters:(跳过字符:)
whitespaceopt   not-number-sign   input-charactersopt(空白可选    非数字符号   输入字符可选)
not-number-sign:(非数字符号:)
除 # 外的任何输入字符
pp-line:(pp 行:)
whitespaceopt   #    whitespaceopt   line    whitespace   line-indicator   pp-new-line(空白可选    #   空白可选    line   空白    行指示符    pp 新行)
line-indicator:(行指示符:)
decimal-digits   whitespace   file-name(十进制数字    空白    文件名)
decimal-digits(十进制数字)
default(default)
file-name:(文件名:)
"    file-name-characters   "("   文件名字符   ")
file-name-characters:(文件名字符:)
file-name-character(文件名字符)
file-name-characters   file-name-character(文件名字符   文件名字符)
file-name-character:(文件名字符:)
除 " 外的任何输入字符
pp-diagnostic:(pp 诊断:)
whitespaceopt   #    whitespaceopt   error    pp-message(空白 可选   #   空白 可选   error   pp 消息)
whitespaceopt   #    whitespaceopt   warning    pp-message(空白 可选   #   空白 可选   warning   pp 消息)
pp-message:(pp 消息:)
new-line(新行)
whitespace   input-charactersopt   new-line(空白   输入字符 可选   新行)
pp-region:(pp 区域:)
pp-start-region   conditional-sectionopt   pp-end-region(pp 开始区域   条件节可选    pp 结束区域)
pp-start-region:(pp 开始区域:)
whitespaceopt   #    whitespaceopt   region    pp-message(空白 可选   #   空白 可选   region   pp 消息)
pp-end-region:(pp 结束区域:)
whitespaceopt   #    whitespaceopt   endregion    pp-message(空白 可选   #   空白 可选   endregion   pp 消息)

C.2 语法

C.2.1 基本概念

namespace-name:(命名空间名称:)
namespace-or-type-name(命名空间或类型名称)
type-name:(类型名:)
namespace-or-type-name(命名空间或类型名称)
namespace-or-type-name:(命名空间或类型名称:)
identifier(标识符)
namespace-or-type-name   .    identifier(命名空间或类型名称   .   标识符)

C.2.2 类型

type:(类型:)
value-type(值类型)
reference-type(引用类型)
value-type:(值类型:)
struct-type(结构类型)
enum-type(枚举类型)
struct-type:(结构类型:)
type-name(类型名称)
simple-type(简单类型)
simple-type:(简单类型:)
numeric-type(数值类型)
bool
numeric-type:(数值类型:)
integral-type(整型)
floating-point-type(浮点类型)
decimal
integral-type:(整型:)
sbyte
byte
short
ushort
int
uint
long
ulong
char
floating-point-type:(浮点类型:)
float
double
enum-type:(枚举类型:)
type-name(类型名)
reference-type:(引用类型:)
class-type(类类型)
interface-type(接口类型)
array-type(数组类型)
delegate-type(委托类型)
class-type:(类类型:)
type-name(类型名)
object
string
interface-type:(接口类型:)
type-name(类型名)
array-type:(数组类型:)
non-array-type   rank-specifiers(非数组类型   秩说明符)
non-array-type:(非数组类型:)
type(类型)
rank-specifiers:(秩说明符:)
rank-specifier(秩说明符)
rank-specifiers   rank-specifier(秩说明符   秩说明符)
rank-specifier:(秩说明符)
[    dim-separatorsopt   ]([   维度分隔符 可选   ])
dim-separators:(维度分隔符:)
,
dim-separators   ,(维度分隔符   ,)
delegate-type:(委托类型:)
type-name(类型名)

C.2.3 变量

variable-reference:(变量引用:)
expression(表达式)

C.2.4 表达式

argument-list:(参数列表:)
argument(参数)
argument-list   ,    argument(参数列表   ,   参数)
argument:(参数:)
expression(表达式)
ref    variable-reference(ref   变量引用)
out    variable-reference(out   变量引用)
primary-expression:(基本表达式:)
primary-no-array-creation-expression(非数组创建基本表达式)
array-creation-expression(数组创建表达式)
primary-no-array-creation-expression:(非数组创建基本表达式:)
literal(文本)
simple-name(简称)
parenthesized-expression(带括号的表达式)
member-access(成员访问)
invocation-expression(调用表达式)
element-access(元素访问)
this-access(this 访问)
base-access(base 访问)
post-increment-expression(后增量表达式)
post-decrement-expression(后减量表达式)
object-creation-expression(对象创建表达式)
delegate-creation-expression(委托创建表达式)
typeof-expression(typeof 表达式)
sizeof-expression(sizeof 表达式)
checked-expression(checked 表达式)
unchecked-expression(unchecked 表达式)
simple-name:(简称:)
identifier(标识符)
parenthesized-expression:(带括号的表达式:)
(    expression   )((   表达式   ))
member-access:(成员访问:)
primary-expression   .    identifier(基本表达式   .   标识符)
predefined-type   .    identifier(预定义类型   .   标识符)
predefined-type: one of(预定义类型:下列之一)
bool byte char decimal double float int long
object sbyte short string uint ulong ushort
invocation-expression:(调用表达式:)
primary-expression   (    argument-listopt   )(基本表达式   (   参数列表可选   ))
element-access:(元素访问:)
primary-no-array-creation-expression   [    expression-list   ](非数组创建基本表达式    [    表达式列表    ])
expression-list:(表达式列表:)
expression(表达式)
expression-list   ,    expression(表达式列表   ,   表达式)
this-access:(this 访问:)
this
base-access:(base 访问:)
base   .    identifier(base   .   标识符)
base   [    expression-list   ](base   [   表达式列表   ])
post-increment-expression:(后增量表达式:)
primary-expression   ++(基本表达式   ++)
post-decrement-expression:(后减量表达式:)
primary-expression   --(基本表达式   --)
object-creation-expression:(对象创建表达式:)
new    type   (    argument-listopt   )(new   类型   (   参数列表可选    ))
array-creation-expression:(数组创建表达式:)
new    non-array-type   [    expression-list   ]    rank-specifiersopt   array-initializeropt(new   非数组类型   [   表达式列表   ]   秩说明符可选    数组初始值设定项可选)
new    array-type    array-initializer(new   数组类型   数组初始值设定项)
delegate-creation-expression:(委托创建表达式:)
new    delegate-type   (    expression   )(new   委托类型   (   表达式   ))
typeof-expression:(typeof 表达式:)
typeof   (    type   )(typeof   (   类型   ))
typeof   (   void   )
checked-expression:(checked 表达式:)
checked   (    expression   )(checked   (   表达式   ))
unchecked-expression:(unchecked 表达式:)
unchecked   (    expression   )(unchecked   (   表达式   ))
unary-expression:(一元表达式:)
primary-expression(基本表达式)
+    unary-expression(+   一元表达式)
-    unary-expression(-   一元表达式)
!    unary-expression(!   一元表达式)
~    unary-expression(~   一元表达式)
*    unary-expression(*   一元表达式)
pre-increment-expression(前增量表达式)
pre-decrement-expression(前减量表达式)
cast-expression(强制转换表达式)
pre-increment-expression:(前增量表达式:)
++    unary-expression(++   一元表达式)
pre-decrement-expression:(前减量表达式:)
--    unary-expression(--   一元表达式)
cast-expression:(强制转换表达式:)
(    type   )    unary-expression((   类型   )   一元表达式)
multiplicative-expression:(乘法表达式:)
unary-expression(一元表达式)
multiplicative-expression   *    unary-expression(乘法表达式   *   一元表达式)
multiplicative-expression   /    unary-expression(乘法表达式   /   一元表达式)
multiplicative-expression   %    unary-expression(乘法表达式   %   一元表达式)
additive-expression:(增量表达式:)
multiplicative-expression(乘法表达式)
additive-expression   +    multiplicative-expression(加法表达式   +   乘法表达式)
additive-expression   –    multiplicative-expression(加法表达式   –   乘法表达式)
shift-expression:(移位表达式:)
additive-expression(加法表达式)
shift-expression   <<    additive-expression(移位表达式   <<   加法表达式)
shift-expression   >>    additive-expression(移位表达式   >>   加法表达式)
relational-expression:(关系表达式:)
shift-expression(移位表达式)
relational-expression   <    shift-expression(关系表达式   <   移位表达式)
relational-expression   >    shift-expression(关系表达式   >   移位表达式)
relational-expression   <=    shift-expression(关系表达式   <=   移位表达式)
relational-expression   >=    shift-expression(关系表达式   >=   移位表达式)
relational-expression   is    type(关系表达式   is   类型)
relational-expression   as    type(关系表达式   as   类型)
equality-expression:(相等表达式:)
relational-expression(关系表达式)
equality-expression   ==    relational-expression(相等表达式   ==   关系表达式)
equality-expression   !=    relational-expression(相等表达式   !=   关系表达式)
and-expression:(与表达式:)
equality-expression(相等表达式)
and-expression   &    equality-expression(与表达式   &   相等表达式)
exclusive-or-expression:(异或表达式:)
and-expression(与表达式)
exclusive-or-expression   ^    and-expression(异或表达式   ^   与表达式)
inclusive-or-expression:(或表达式:)
exclusive-or-expression(异或表达式)
inclusive-or-expression   |    exclusive-or-expression(异或表达式   |   异或表达式)
conditional-and-expression:(条件与表达式:)
inclusive-or-expression(或表达式)
conditional-and-expression   &&    inclusive-or-expression(条件与表达式   &&   或表达式)
conditional-or-expression:(条件或表达式:)
conditional-and-expression(条件与表达式)
conditional-or-expression   ||     conditional-and-expression(条件或表达式   ||   条件与表达式)
conditional-expression:(条件表达式:)
conditional-or-expression(条件或表达式)
conditional-or-expression   ?    expression   :    expression(条件或表达式   ?   表达式   :   表达式)
assignment:(赋值:)
unary-expression   assignment-operator   expression(一元表达式   赋值运算符   表达式)
assignment-operator: one of(赋值运算符:下列之一)
=   +=   -=   *=   /=   %=   &=   | =   ^=   <<=   >>=
expression:(表达式:)
conditional-expression(条件表达式)
assignment(赋值)
constant-expression:(常数表达式:)
expression(表达式)
boolean-expression:(布尔表达式:)
expression(表达式)

C.2.5 语句

statement:(语句:)
labeled-statement(标记语句)
declaration-statement(声明语句)
embedded-statement(嵌入语句)
embedded-statement:(嵌入语句:)
block(块)
empty-statement(空语句)
expression-statement(表达式语句)
selection-statement(选择语句)
iteration-statement(迭代语句)
jump-statement(跳转语句)
try-statement(try 语句)
checked-statement(checked 语句)
unchecked-statement(unchecked 语句)
lock-statement(lock 语句)
using-statement(using 语句)
block:(块:)
{    statement-listopt   }({   语句列表 可选   })
statement-list:(语句列表:)
statement(语句)
statement-list   statement(语句列表   语句)
empty-statement:(空语句:)
;
labeled-statement:(标记语句:)
identifier   :    statement(标识符   :   语句)
declaration-statement:(声明语句:)
local-variable-declaration   ;(局部变量声明   ;)
local-constant-declaration   ;(局部常数声明   ;)
local-variable-declaration:(局部变量声明:)
type   local-variable-declarators(类型   局部变量声明符)
local-variable-declarators:(局部变量声明符:)
local-variable-declarator(局部变量声明符)
local-variable-declarators   ,    local-variable-declarator(局部变量声明符   ,   局部变量声明符)
local-variable-declarator:(局部变量声明符:)
identifier(标识符)
identifier   =   local-variable-initializer(标识符   =   局部变量初始值设定项)
local-variable-initializer:(局部变量初始值设定项:)
expression(表达式)
array-initializer(数组初始值设定项)
local-constant-declaration:(局部常数声明:)
const    type   constant-declarators(const   类型   常数声明符)
constant-declarators:(常数声明符:)
constant-declarator(常数声明符)
constant-declarators   ,    constant-declarator(常数声明符   ,   常数声明符)
constant-declarator:(常数声明符:)
identifier   =   constant-expression(标识符   =   常数表达式)
expression-statement:(表达式语句:)
statement-expression   ;(语句表达式   ;)
statement-expression:(语句表达式:)
invocation-expression(调用表达式)
object-creation-expression(对象创建表达式)
assignment(赋值)
post-increment-expression(后递增表达式)
post-decrement-expression(后递减表达式)
pre-increment-expression(前递增表达式)
pre-decrement-expression(前递减表达式)
selection-statement:(选择语句:)
if-statement(if 语句)
switch-statement(switch 语句)
if-statement:(if 语句:)
if   (    boolean-expression   )    embedded-statement(if   (   布尔表达式    )   嵌入语句)
if   (    boolean-expression   )    embedded-statement   else    embedded-statement(if   (   布尔表达式   )   嵌入语句   else   嵌入语句)
boolean-expression:(布尔表达式:)
expression(表达式)
switch-statement:(switch 语句:)
switch   (    expression   )    switch-block(switch   (   表达式   )   switch 块)
switch-block:(switch 块:)
{    switch-sectionsopt   }({   switch 节 可选   })
switch-sections:(switch 节:)
switch-section(switch 节)
switch-sections   switch-section(switch 节   switch 节)
switch-section:(switch 节:)
switch-labels   statement-list(switch 标签   语句列表)
switch-labels:(switch 标签:)
switch-label(switch 标签)
switch-labels   switch-label(switch 标签   switch 标签)
switch-label:(switch 标签:)
case    constant-expression   :(case   常数表达式   :)
default   :(default   :)
iteration-statement:(迭代语句:)
while-statement(while 语句)
do-statement(do 语句)
for-statement(for 语句)
foreach-statement(foreach 语句)
while-statement:(while 语句:)
while   (    boolean-expression   )    embedded-statement(while   (   布尔表达式   )   嵌入语句)
do-statement:(do 语句:)
do    embedded-statement   while   (    boolean-expression   )   ;(do   嵌入语句   while   (   布尔表达式   )   ;)
for-statement:(for 语句:)
for   (    for-initializeropt   ;    for-conditionopt   ;    for-iteratoropt   )    embedded-statement(for   (   for 初始值设定项 可选   ;   for 条件 可选   ;   for 迭代程序 可选   )   嵌入语句)
for-initializer:(for 初始值设定项:)
local-variable-declaration(局部变量声明)
statement-expression-list(语句表达式列表)
for-condition:(for 条件:)
boolean-expression(布尔表达式)
for-iterator:(for 迭代程序:)
statement-expression-list(语句表达式列表)
statement-expression-list:(语句表达式列表:)
statement-expression(语句表达式)
statement-expression-list   ,    statement-expression(语句表达式列表   ,   语句表达式)
foreach-statement:(foreach 语句:)
foreach   (    type   identifier   in    expression   )    embedded-statement(foreach   (   类型   标识符   in   表达式   )   嵌入语句)
jump-statement:(跳转语句:)
break-statement(break 语句)
continue-statement(continue 语句)
goto-statement(goto 语句)
return-statement(return 语句)
throw-statement(throw 语句)
break-statement:(break 语句:)
break   ;
continue-statement:(continue 语句:)
continue   ;
goto-statement:(goto 语句:)
goto    identifier   ;(goto   标识符   ;)
goto   case    constant-expression   ;(goto   case   常数表达式   ;)
goto   default   ;(goto   default   ;)
return-statement:(return 语句:)
return    expressionopt   ;(return   表达式 可选   ;)
throw-statement:(throw 语句:)
throw    expressionopt   ;(throw   表达式 可选   ;)
try-statement:(try 语句:)
try    block   catch-clauses(try   块   catch 子句)
try    block   finally-clause(try   块   finally 子句)
try    block   catch-clauses   finally-clause(try   块   catch 子句   finally 子句)
catch-clauses:(catch 子句:)
specific-catch-clauses   general-catch-clauseopt(特定 catch 子句   常规 catch 子句 可选
specific-catch-clausesopt   general-catch-clause(特定 catch 子句 可选   常规 catch 子句)
specific-catch-clauses:(特定 catch 子句:)
specific-catch-clause(特定 catch 子句)
specific-catch-clauses   specific-catch-clause(特定 catch 子句    特定 catch 子句)
specific-catch-clause:(特定 catch 子句:)
catch   (    class-type    identifieropt   )    block(catch   (   类类型   标识符 可选   )   块)
general-catch-clause:(常规 catch 子句:)
catch    block(catch   块)
finally-clause:(finally 子句:)
finally    block(finally   块)
checked-statement:(checked 语句:)
checked    block(checked   块)
unchecked-statement:(unchecked 语句:)
unchecked    block(unchecked   块)
lock-statement:(lock 语句:)
lock   (    expression   )    embedded-statement(lock   (   表达式   )   嵌入语句)
using-statement:(using 语句:)
using   (     resource-acquisition   )     embedded-statement(using   (    资源获取   )    嵌入语句)
resource-acquisition:(资源获取:)
local-variable-declaration(局部变量声明)
expression(表达式)

C.2.6 命名空间

compilation-unit:(编译单元:)
using-directivesopt   global-attributesopt   namespace-member-declarationsopt(using 指令 可选   全局属性 可选   命名空间成员声明 可选
namespace-declaration:(命名空间声明:)
namespace    qualified-identifier   namespace-body   ; opt(命名空间   限定标识符   命名空间体   ;可选)
qualified-identifier:(限定标识符:)
identifier(标识符)
qualified-identifier   .    identifier(限定标识符   .   标识符)
namespace-body:(命名空间体:)
{    using-directivesopt   namespace-member-declarationsopt   }({   using 指令 可选   命名空间成员声明 可选   })
using-directives:(using 指令:)
using-directive(using 指令)
using-directives   using-directive(using 指令   using 指令)
using-directive:(using 指令:)
using-alias-directive(using 别名指令)
using-namespace-directive(using 命名空间指令)
using-alias-directive:(using 别名指令:)
using    identifier   =    namespace-or-type-name   ;(using   标识符   =   命名空间或类型名称   ;)
using-namespace-directive:(using 命名空间指令:)
using    namespace-name   ;(using   命名空间名称   ;)
namespace-member-declarations:(命名空间成员声明:)
namespace-member-declaration(命名空间成员声明)
namespace-member-declarations   namespace-member-declaration(命名空间成员声明   命名空间成员声明)
namespace-member-declaration:(命名空间成员声明:)
namespace-declaration(命名空间声明)
type-declaration(类型声明)
type-declaration:(类型声明:)
class-declaration(类声明)
struct-declaration(结构声明)
interface-declaration(接口声明)
enum-declaration(枚举声明)
delegate-declaration(委托声明)

C.2.7 类

class-declaration:(类声明:)
attributesopt   class-modifiersopt   class    identifier   class-baseopt   class-body   ; opt(属性可选   类修饰符可选   class   标识符   类基可选   类体   ;可选)
class-modifiers:(类修饰符:)
class-modifier(类修饰符)
class-modifiers   class-modifier(类修饰符   类修饰符)
class-modifier:(类修饰符:)
new
public
protected
internal
private
abstract
sealed
class-base:(类基:)
:    class-type(:   类类型)
:    interface-type-list(:   接口类型列表)
:    class-type   ,    interface-type-list(:   类类型   ,   接口类型列表)
interface-type-list:(接口类型列表:)
interface-type(接口类型)
interface-type-list   ,    interface-type(接口类型列表   ,   接口类型)
class-body:(类体:)
{    class-member-declarationsopt   }({   类成员声明 可选   })
class-member-declarations:(类成员声明:)
class-member-declaration(类成员声明)
class-member-declarations   class-member-declaration(类成员声明   类成员声明)
class-member-declaration:(类成员声明:)
constant-declaration(常数声明)
field-declaration(字段声明)
method-declaration(方法声明)
property-declaration(属性声明)
event-declaration(事件声明)
indexer-declaration(索引器声明)
operator-declaration(运算符声明)
constructor-declaration(构造函数声明)
destructor-declaration(析构函数声明)
static-constructor-declaration(静态构造函数声明)
type-declaration(类型声明)
constant-declaration:(常数声明:)
attributesopt   constant-modifiersopt   const    type   constant-declarators   ;(属性可选   常数修饰符可选   const   类型   常数声明符   ;)
constant-modifiers:(常数修饰符:)
constant-modifier(常数修饰符)
constant-modifiers   constant-modifier(常数修饰符   常数修饰符)
constant-modifier:(常数修饰符:)
new
public
protected
internal
private
constant-declarators:(常数声明符:)
constant-declarator(常数声明符)
constant-declarators   ,    constant-declarator(常数声明符   ,   常数声明符)
constant-declarator:(常数声明符:)
identifier   =   constant-expression(标识符   =   常数表达式)
field-declaration:(字段声明:)
attributesopt   field-modifiersopt   type   variable-declarators   ;(属性 可选   字段修饰符 可选   类型    变量声明符    ;)
field-modifiers:(字段修饰符:)
field-modifier(字段修饰符)
field-modifiers   field-modifier(字段修饰符    字段修饰符)
field-modifier:(字段修饰符:)
new
public
protected
internal
private
static
readonly
volatile
variable-declarators:(变量声明符:)
variable-declarator(变量声明符)
variable-declarators   ,    variable-declarator(变量声明符   ,   变量声明符)
variable-declarator:(变量声明符:)
identifier(标识符)
identifier   =   variable-initializer(标识符   =   变量初始值设定项)
variable-initializer:(变量初始值设定项:)
expression(表达式)
array-initializer(数组初始值设定项)
method-declaration:(方法声明:)
method-header   method-body(方法头   方法体)
method-header:(方法头:)
attributesopt   method-modifiersopt   return-type   member-name   (    formal-parameter-listopt   )(属性 可选   方法修饰符 可选   返回类型    成员名    (    形参表 可选   ))
method-modifiers:(方法修饰符:)
method-modifier(方法修饰符)
method-modifiers   method-modifier(方法修饰符   方法修饰符)
method-modifier:(方法修饰符:)
new
public
protected
internal
private
static
virtual
sealed
override
abstract
extern
return-type:(返回类型:)
type(类型)
void
member-name:(成员名:)
identifier(标识符)
interface-type   .    identifier(接口类型   .   标识符)
method-body:(方法体:)
block(块)
;
formal-parameter-list:(形参表:)
fixed-parameters(固定参数)
fixed-parameters   ,    parameter-array(固定参数   ,   参数数组)
parameter-array(参数数组)
fixed-parameters:(固定参数:)
fixed-parameter(固定参数)
fixed-parameters   ,    fixed-parameter(固定参数   ,   固定参数)
fixed-parameter:(固定参数:)
attributesopt   parameter-modifieropt   type   identifier(属性可选   参数修饰符可选   类型   标识符)
parameter-modifier:(参数修饰符:)
ref
out
parameter-array:(参数数组:)
attributesopt   params    array-type   identifier(属性可选   params   数组类型   标识符)
property-declaration:(属性声明:)
attributesopt   property-modifiersopt   type   member-name   {    accessor-declarations   }(属性 可选   属性修饰符 可选   类型   成员名   {   访问器声明   })
property-modifiers:(属性修饰符:)
property-modifier(属性修饰符)
property-modifiers   property-modifier(属性修饰符   属性修饰符)
property-modifier:(属性修饰符:)
new
public
protected
internal
private
static
virtual
sealed
override
abstract
extern
member-name:(成员名:)
identifier(标识符)
interface-type   .    identifier(接口类型   .   标识符)
accessor-declarations:(访问器声明:)
get-accessor-declaration   set-accessor-declarationopt(get 访问器声明   set 访问器声明 可选
set-accessor-declaration   get-accessor-declarationopt(set 访问器声明   get 访问器声明 可选
get-accessor-declaration:(get 访问器声明:)
attributesopt   get    accessor-body(属性 可选   get   访问器体)
set-accessor-declaration:(set 访问器声明:)
attributesopt   set    accessor-body(属性 可选   set   访问器体)
accessor-body:(访问器体:)
block(块)
;
event-declaration:(事件声明:)
attributesopt   event-modifiersopt   event    type   variable-declarators   ;(属性 可选   事件修饰符 可选   event   类型   变量声明符   ;)
attributesopt   event-modifiersopt   event    type   member-name   {    event-accessor-declarations   }(属性 可选   事件修饰符 可选   event   类型   成员名   {   事件访问器声明   })
event-modifiers:(事件修饰符:)
event-modifier(事件修饰符)
event-modifiers   event-modifier(事件修饰符   事件修饰符)
event-modifier:(事件修饰符:)
new
public
protected
internal
private
static
virtual
sealed
override
abstract
extern
event-accessor-declarations:(事件访问器声明:)
add-accessor-declaration   remove-accessor-declaration(添加访问器声明   移除访问器声明)
remove-accessor-declaration   add-accessor-declaration(移除访问器声明   添加访问器声明)
add-accessor-declaration:(添加访问器声明:)
attributesopt   add    block(属性 可选   add   块)
remove-accessor-declaration:(移除访问器声明:)
attributesopt   remove    block(属性 可选   remove   块)
indexer-declaration:(索引器声明:)
attributesopt   indexer-modifiersopt   indexer-declarator   {    accessor-declarations   }(属性 可选   索引器修饰符 可选   索引器声明符   {   访问器声明   })
indexer-modifiers:(索引器修饰符:)
indexer-modifier(索引器修饰符)
indexer-modifiers   indexer-modifier(索引器修饰符   索引器修饰符)
indexer-modifier:(索引器修饰符:)
new
public
protected
internal
private
virtual
sealed
override
abstract
extern
indexer-declarator:(索引器声明符:)
type   this   [    formal-parameter-list   ](类型   this   [   形参表   ])
type   interface-type   .   this   [    formal-parameter-list   ](类型   接口类型   .   this   [   形参表   ])
operator-declaration:(运算符声明:)
attributesopt   operator-modifiers   operator-declarator   operator-body(属性可选   运算符修饰符   运算符声明符   运算符体)
operator-modifiers:(运算符修饰符:)
operator-modifier(运算符修饰符)
operator-modifiers   operator-modifier(运算符修饰符   运算符修饰符)
operator-modifier:(运算符修饰符:)
public
static
extern
operator-declarator:(运算符声明符:)
unary-operator-declarator(一元运算符声明符)
binary-operator-declarator(二元运算符声明符)
conversion-operator-declarator(转换运算符声明符)
unary-operator-declarator:(一元运算符声明符:)
type   operator    overloadable-unary-operator   (    type   identifier   )(类型   operator   可重载的一元运算符   (   类型   标识符   ))
overloadable-unary-operator: one of(可重载的一元运算符:下列之一)
+   -   !   ~   ++   --   true   false
binary-operator-declarator:(二元运算符声明符:)
type   operator    overloadable-binary-operator   (    type   identifier   ,    type   identifier   )(类型   operator   可重载的二元运算符   (   类型   标识符   ,   类型   标识符   ))
overloadable-binary-operator: one of(可重载的二元运算符:下列之一)
+   -   *   /   %   &   |    ^   <<   >>   ==   !=   >   <   >=   <=
conversion-operator-declarator:(转换运算符声明符:)
implicit   operator    type   (    type   identifier   )(implicit   operator   类型   (   类型   标识符   ))
explicit   operator    type   (    type   identifier   )(explicit   operator   类型   (   类型   标识符   ))
operator-body:(运算符体:)
block(块)
;
constructor-declaration:(构造函数声明:)
attributesopt   constructor-modifiersopt   constructor-declarator   constructor-body(属性可选   构造函数修饰符可选   构造函数声明符   构造函数体)
constructor-modifiers:(构造函数修饰符:)
constructor-modifier(构造函数修饰符)
constructor-modifiers   constructor-modifier(构造函数修饰符   构造函数修饰符)
constructor-modifier:(构造函数修饰符:)
public
protected
internal
private
extern
constructor-declarator:(构造函数声明符:)
identifier   (    formal-parameter-listopt   )    constructor-initializeropt(标识符   (   形参表 可选   )   构造函数初始值设定项 可选
constructor-initializer:(构造函数初始值设定项:)
:   base   (    argument-listopt   )(:   base   (   参数列表 可选   ))
:   this   (    argument-listopt   )(:   this   (   参数列表 可选   ))
constructor-body:(构造函数体:)
block(块)
;
static-constructor-declaration:(静态构造函数声明:)
attributesopt   static-constructor-modifiers   identifier   (   )    static-constructor-body(属性 可选   静态构造函数修饰符   标识符   (   )   静态构造函数体)
static-constructor-modifiers:(静态构造函数修饰符:)
extern opt static(extern 可选 static)
static extern opt(static extern 可选
static-constructor-body:(静态构造函数体:)
block(块)
;
destructor-declaration:(析构函数声明:)
attributesopt   extern opt   ~    identifier   (   )     destructor-body(属性 可选   extern 可选   ~   标识符   (   )    析构函数体)
destructor-body:(析构函数体:)
block(块)
;

C.2.8 结构

struct-declaration:(结构声明:)
attributesopt   struct-modifiersopt   struct    identifier   struct-interfacesopt   struct-body   ; opt(属性 可选   结构修饰符 可选   struct   标识符   结构接口 可选   结构体   ; 可选
struct-modifiers:(结构修饰符:)
struct-modifier(结构修饰符)
struct-modifiers   struct-modifier(结构修饰符   结构修饰符)
struct-modifier:(结构修饰符:)
new
public
protected
internal
private
struct-interfaces:(结构接口:)
:    interface-type-list(:   接口类型列表)
struct-body:(结构体:)
{    struct-member-declarationsopt   }({   结构成员声明 可选   })
struct-member-declarations:(结构成员声明:)
struct-member-declaration(结构成员声明)
struct-member-declarations   struct-member-declaration(结构成员声明   结构成员声明)
struct-member-declaration:(结构成员声明:)
constant-declaration(常数声明)
field-declaration(字段声明)
method-declaration(方法声明)
property-declaration(属性声明)
event-declaration(事件声明)
indexer-declaration(索引器声明)
operator-declaration(运算符声明)
constructor-declaration(构造函数声明)
static-constructor-declaration(静态构造函数声明)
type-declaration(类型声明)

C.2.9 数组

array-type:(数组类型:)
non-array-type   rank-specifiers(非数组类型   秩说明符)
non-array-type:(非数组类型:)
type(类型)
rank-specifiers:(秩说明符:)
rank-specifier(秩说明符)
rank-specifiers   rank-specifier(秩说明符   秩说明符)
rank-specifier:(秩说明符:)
[    dim-separatorsopt   ]([   维度分隔符 可选   ])
dim-separators:(维度分隔符:)
,
dim-separators   ,(维度分隔符   ,)
array-initializer:(数组初始值设定项:)
{    variable-initializer-listopt   }({   变量初始值设定项列表 可选   })
{    variable-initializer-list   ,   }({   变量初始值设定项列表   ,   })
variable-initializer-list:(变量初始值设定项列表:)
variable-initializer(变量初始值设定项)
variable-initializer-list   ,    variable-initializer(变量初始值设定项列表   ,   变量初始值设定项)
variable-initializer:(变量初始值设定项:)
expression(表达式)
array-initializer(数组初始值设定项)

C.2.10 接口

interface-declaration:(接口声明:)
attributesopt   interface-modifiersopt   interface    identifier   interface-baseopt   interface-body   ; opt(属性可选    接口修饰符可选    interface   标识符   接口基可选    接口体   ;可选)
interface-modifiers:(接口修饰符:)
interface-modifier(接口修饰符)
interface-modifiers   interface-modifier(接口修饰符   接口修饰符)
interface-modifier:(接口修饰符:)
new
public
protected
internal
private
interface-base:(接口基:)
:    interface-type-list(:   接口类型列表)
interface-body:(接口体:)
{    interface-member-declarationsopt   }({   接口成员声明 可选   })
interface-member-declarations:(接口成员声明:)
interface-member-declaration(接口成员声明)
interface-member-declarations   interface-member-declaration(接口成员声明   接口成员声明)
interface-member-declaration:(接口成员声明:)
interface-method-declaration(接口方法声明)
interface-property-declaration(接口属性声明)
interface-event-declaration(接口事件声明)
interface-indexer-declaration(接口索引器声明)
interface-method-declaration:(接口方法声明:)
attributesopt   new opt   return-type   identifier   (    formal-parameter-listopt   )   ;(属性可选    new可选    返回类型   标识符   (   形参表可选    )   ;)
interface-property-declaration:(接口属性声明:)
attributesopt   new opt   type   identifier   {    interface-accessors   }(属性可选    new可选    类型   标识符   {   接口访问器   })
interface-accessors:(接口访问器:)
attributesopt   get   ;(属性 可选   get   ;)
attributesopt   set   ;(属性 可选   set   ;)
attributesopt   get   ;    attributesopt   set   ;(属性 可选   get   ;   属性 可选   set   ;)
attributesopt   set   ;    attributesopt   get   ;(属性 可选   set   ;   属性 可选   get   ;)
interface-event-declaration:(接口事件声明:)
attributesopt   new opt   event    type   identifier   ;(属性可选    new可选    event   类型   标识符   ;)
interface-indexer-declaration:(接口索引器声明:)
attributesopt   new opt   type   this   [    formal-parameter-list   ]   {    interface-accessors   }(属性可选    new可选    类型   this   [   形参表   ]   {   接口访问器   })

C.2.11 枚举

enum-declaration:(枚举声明:)
attributesopt   enum-modifiersopt   enum    identifier   enum-baseopt   enum-body   ; opt(属性可选    枚举修饰符可选    enum   标识符   枚举基可选    枚举体   ;可选)
enum-base:(枚举基:)
:    integral-type(:   整型)
enum-body:(枚举体:)
{    enum-member-declarationsopt   }({   枚举成员声明 可选   })
{    enum-member-declarations   ,   }({   枚举成员声明   ,   })
enum-modifiers:(枚举修饰符:)
enum-modifier(枚举修饰符)
enum-modifiers   enum-modifier(枚举修饰符   枚举修饰符)
enum-modifier:(枚举修饰符:)
new
public
protected
internal
private
enum-member-declarations:(枚举成员声明:)
enum-member-declaration(枚举成员声明)
enum-member-declarations   ,    enum-member-declaration(枚举成员声明   ,   枚举成员声明)
enum-member-declaration:(枚举成员声明:)
attributesopt   identifier(属性 可选   标识符)
attributesopt   identifier   =    constant-expression(属性 可选   标识符   =   常数表达式)

C.2.12 委托

delegate-declaration:(委托声明:)
attributesopt   delegate-modifiersopt   delegate    return-type   identifier   (    formal-parameter-listopt   )   ;(属性 可选   委托修饰符 可选   delegate   返回类型   标识符   (   形参表 可选   )   ;)
delegate-modifiers:(委托修饰符:)
delegate-modifier(委托修饰符)
delegate-modifiers   delegate-modifier(委托修饰符   委托修饰符)
delegate-modifier:(委托修饰符:)
new
public
protected
internal
private

C.2.13 属性

global-attributes:(全局属性:)
global-attribute-sections(全局属性节)
global-attribute-sections:(全局属性节:)
global-attribute-section(全局属性节)
global-attribute-sections global-attribute-section(全局属性节全局属性节)
global-attribute-section:(全局属性节:)
[   global-attribute-target-specifier   attribute-list   ]([    全局属性目标说明符    属性列表    ])
[   global-attribute-target-specifier   attribute-list   ,]([    全局属性目标说明符    属性列表    ,])
global-attribute-target-specifier:(全局属性目标说明符:)
global-attribute-target    :(全局属性目标   :)
global-attribute-target:(全局属性目标:)
assembly(程序集)
module(模块)
attributes:(属性:)
attribute-sections(属性节)
attribute-sections:(属性节:)
attribute-section(属性节)
attribute-sections   attribute-section(属性节   属性节)
attribute-section:(属性节:)
[    attribute-target-specifier opt    attribute-list   ]([   属性目标说明符可选    属性列表   ])
[    attribute-target-specifier opt    attribute-list   ,   ]([   属性目标说明符可选    属性列表   ,   ])
attribute-target-specifier:(属性目标说明符:)
attribute-target   :(属性目标   :)
attribute-target:(属性目标:)
field(字段)
event(事件)
method(方法)
param(参数)
property(属性)
return(返回)
type(类型)
attribute-list:(属性列表:)
attribute(属性)
attribute-list   ,    attribute(属性列表    ,   属性)
attribute:(属性:)
attribute-name   attribute-argumentsopt(属性名   属性参数可选)
attribute-name:(属性名:)
type-name(类型名)
attribute-arguments:(属性参数:)
(    positional-argument-list opt   )((   定位参数列表可选    ))
(    positional-argument-list   ,    named-argument-list   )((   定位参数列表   ,   命名参数列表   ))
(    named-argument-list   )((   命名参数列表   ))
positional-argument-list:(定位参数列表:)
positional-argument(定位参数)
positional-argument-list   ,   positional-argument(定位参数列表    ,    定位参数)
positional-argument:(定位参数:)
attribute-argument-expression(属性参数表达式)
named-argument-list:(命名参数列表:)
named-argument(命名参数)
named-argument-list   ,   named-argument(命名参数列表    ,    命名参数)
named-argument:(命名参数:)
identifier   =   attribute-argument-expression(标识符   =   属性参数表达式)
attribute-argument-expression:(属性参数表达式:)
expression(表达式)

C.3 不安全代码的语法扩展

class-modifier:(类修饰符:)
...
unsafe
struct-modifier:(结构修饰符:)
...
unsafe
interface-modifier:(接口修饰符:)
...
unsafe
delegate-modifier:(委托修饰符:)
...
unsafe
field-modifier:(字段修饰符:)
...
unsafe
method-modifier:(方法修饰符:)
...
unsafe
property-modifier:(属性修饰符:)
...
unsafe
event-modifier:(事件修饰符:)
...
unsafe
indexer-modifier:(索引器修饰符:)
...
unsafe
operator-modifier:(运算符修饰符:)
...
unsafe
constructor-modifier:(构造函数修饰符:)
...
unsafe
destructor-declaration:(析构函数声明:)
attributesopt   extern opt   unsafe opt   ~    identifier   (   )     destructor-body(属性 可选   extern 可选   unsafe 可选   ~   标识符    (   )    析构函数体)
attributesopt   unsafe opt   extern opt   ~    identifier   (   )     destructor-body(属性 可选   unsafe 可选   extern 可选   ~   标识符   (   )    析构函数体)
static-constructor-modifiers:(静态构造函数修饰符:)
extern opt   unsafe opt   static(extern 可选   unsafe 可选   静态)
unsafe opt   extern opt   static(unsafe 可选   extern 可选   静态)
extern opt   static   unsafe opt(extern 可选   静态   unsafe 可选
unsafe opt    static   extern opt(unsafe 可选    静态   extern 可选
static   extern opt   unsafe opt(静态   extern 可选   unsafe 可选
static   unsafe opt   extern opt(静态   unsafe 可选   extern 可选
embedded-statement:(嵌入语句:)
...
unsafe-statement(不安全语句)
unsafe-statement:(不安全语句:)
unsafe    block(unsafe   块)
type:(类型:)
value-type(值类型)
reference-type(引用类型)
pointer-type(指针类型)
pointer-type:(指针类型:)
unmanaged-type   *(非托管类型   *)
void   *(void   *)
unmanaged-type:(非托管类型:)
type(类型)
primary-no-array-creation-expression:(非数组创建基本表达式:)
...
pointer-member-access(指针成员访问)
pointer-element-access(指针元素访问)
sizeof-expression(sizeof 表达式)
unary-expression:(一元表达式:)
...
pointer-indirection-expression(指针间接寻址表达式)
addressof-expression(addressof 表达式)
pointer-indirection-expression:(指针间接寻址表达式:)
*    unary-expression(*   一元表达式)
pointer-member-access:(指针成员访问:)
primary-expression   ->    identifier(基本表达式   ->   标识符)
pointer-element-access:(指针元素访问:)
primary-no-array-creation-expression   [    expression   ](非数组创建基本表达式   [   表达式   ])
addressof-expression:(addressof 表达式:)
&    unary-expression(&   一元表达式)
sizeof-expression:(sizeof 表达式:)
sizeof   (    unmanaged-type   )(sizeof   (   非托管类型   ))
embedded-statement:(嵌入语句:)
...
fixed-statement(固定语句)
fixed-statement:(固定语句:)
fixed   (    pointer-type   fixed-pointer-declarators   )    embedded-statement(fixed   (   指针类型   固定指针声明符   )   嵌入语句)
fixed-pointer-declarators:(固定指针声明符:)
fixed-pointer-declarator(固定指针声明符)
fixed-pointer-declarators   ,    fixed-pointer-declarator(固定指针声明符   ,   固定指针声明符)
fixed-pointer-declarator:(固定指针声明符:)
identifier   =    fixed-pointer-initializer(标识符   =   固定指针初始值设定项)
fixed-pointer-initializer:(固定指针初始值设定项:)
&    variable-reference(&   变量引用)
expression(表达式)
variable-initializer:(变量初始值设定项:)
expression(表达式)
array-initializer(数组初始值设置项)
stackalloc-initializer(stackalloc 初始值设置项)
stackalloc-initializer:(stackalloc 初始值设定项:)
stackalloc    unmanaged-type   [    expression   ](stackalloc   非托管类型   [   表达式   ])
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值