關鍵字是類似標識符的保留的字符序列,不能用作標識符(以 @
字符開頭時除外)。
abstract | as | base | bool | break | byte | case |
catch | char | checked | class | const | continue | decimal |
default | delegate | do | double | else | enum | event |
explicit | extern | false | finally | fixed | float | for |
foreach | goto | if | implicit | in | int | interface |
internal | is | lock | long | namespace | new | null |
object | operator | out | override | params | private | protected |
public | readonly | ref | return | sbyte | sealed | short |
sizeof | stackalloc | static | string | struct | switch | this |
throw | true | try | typeof | uint | ulong | unchecked |
unsafe | ushort | using | virtual | void | volatile | while |
在文法中的某些位置,特定的標識符有特殊的含義,但不是關鍵字。例如,在屬性聲明中,“get”和“set”標識符有特殊的含義(第 10.6.2 節)。在這些位置決不允許使用 get
或 set
以外的標識符,因此這種用法不會與將這些字用作標識符沖突。