关键字是预定义给C#编译器的保留字。这些关键字不能用作标识符。但是,如果要使用这些关键字作为标识符,则可以在关键字前面加上@字符。
以下是C#中的两种关键字。
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 | in (generic modifier) | int |
interface | internal | is | Lock | long | namespace | new |
null | object | operator | Out | out (generic modifier) | 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 |
add | alias | ascending | descending | dynamic | from | get |
global | group | into | join | let | orderby | partial (type) |
partial(method) | remove | select | set |