A keyword is a reserved word. You cannot use it as a variable name, constant name etc.
In C# keywords cannot be used as identifiers. However, if we want to use the keywords as identifiers, we may prefix the keyword with @ character.
A list of Reserved Keywords available in C# programming language is given below:
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 | <>
Some identifiers which have special meaning in context of code are called as Contextual Keywords.
A list of Contextual Keywords available in C# programming language is given below:
add | group | ascending | descending | dynamic | from | get |
---|---|---|---|---|---|---|
global | alias | into | join | let | select | set |
partial (type) | partial(method) | remove | orderby |