📅  最后修改于: 2020-10-30 07:35:39             🧑  作者: Mango
关键字是保留字。您不能将其用作变量名,常量名等。
在C#中,关键字不能用作标识符。但是,如果要使用关键字作为标识符,可以在关键字前面加上@ 字符。
下面列出了C#编程语言中可用的保留关键字列表:
abstract | base | as | bool | break | catch | case |
---|---|---|---|---|---|---|
byte | char | checked | class | const | continue | decimal |
private | protected | public | return | readonly | ref | sbyte |
explicit | extern | false | finally | fixed | float | for |
foreach | goto | if | implicit | in | in (generic modifier) | int |
ulong | ushort | unchecked | using | unsafe | virtual | void |
null | object | operator | out | out (generic modifier) | override | params |
default | delegate | do | double | else | enum | event |
sealed | short | sizeof | stackalloc | static | string | struct |
switch | this | throw | true | try | typeof | uint |
abstract | base | as | bool | break | catch | case |
volatile | while |
一些在代码上下文中具有特殊含义的标识符称为上下文关键字。
下面列出了C#编程语言中可用的上下文关键字的列表:
add | group | ascending | descending | dynamic | from | get |
---|---|---|---|---|---|---|
global | alias | into | join | let | select | set |
partial (type) | partial(method) | remove | orderby |