C# Keywords
By Stephen Bucaro
keywords, sometimes called reserved words, are predefined words that have special
meaning to the compiler. Keywords cannot be used by the programmer as identifiers such as variable,
method, or class names. The compiler uses keywords to interpret the meaning and structure, so the
programmer must use keywords only in designated locations in the code.
Contextual keywords are keywords that were introduced in later versions of C#, but
to keep old code from breaking, these new keywords have special meaning to the compiler only when
used in specific locations.
You can use a keyword as an identifier if you prefix it with a @ character, for example throw
is a keyword which cannot be used, but @throw can be used.
abstract | add * | alias * | as |
ascending * | base | bool | break |
by * | byte | case | catch |
char | checked | class | const |
continue | decimal | default | delegate |
escending * | do | double | dynamic * |
else | enum | equals * | event |
explicit | extern | false | finally |
fixed | float | for | foreach |
from * | get * | global * | goto |
group * | if | implicit | in |
int | interface | internal | into * |
is | join * | let * | lock |
long | namespace | new | null |
object | on * | operator | orderby * |
out | override | params | partial * |
private | protected | public | readonly |
ref | remove * | return | sbyte |
sealed | select * | set * | short |
sizeof | stackalloc | static | string |
struct | switch | this | throw |
true | try | typeof | uint |
ulong | unchecked | unsafe | ushort |
using | value * | var * | virtual |
void | volatile | where * | while |
yield * | | | |
* Contextual keyword
|