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:(静态构造函数修饰符:)
externopt static(extern可选 static)
static externopt(static extern可选)
static-constructor-body:(静态构造函数体:)
block(块)
;
destructor-declaration:(析构函数声明:)
attributesopt externopt ~ identifier ( ) destructor-body(属性可选 extern可选 ~ 标识符 ( ) 析构函数体)
destructor-body:(析构函数体:)
block(块)
;
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:(静态构造函数修饰符:)
externopt static(extern可选 static)
static externopt(static extern可选)
static-constructor-body:(静态构造函数体:)
block(块)
;
destructor-declaration:(析构函数声明:)
attributesopt externopt ~ identifier ( ) destructor-body(属性可选 extern可选 ~ 标识符 ( ) 析构函数体)
destructor-body:(析构函数体:)
block(块)
;