Reserved words
Reserved words are names or identifiers that have predefined meanings to the compiler. They cannot be used as a user-defined identifiers unless they are prefixed with the verbatim character @.
Below are all the reserved words in C# (Docs, 2017).
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 | using static | virtual | void |
volatile | while |
Contextual keywords
They only have special meanings under certain contexts (Docs, 2017).
add | alias | ascending |
async | await | descending |
dynamic | from | get |
global | group | into |
join | let | nameof |
orderby | partial (type) | partial (method) |
remove | select | set |
value | var | when (filter condition) |
where (generic type constraint) | where (query clause) | yield |
References
- Docs, M. (2017, March 7). C# Keywords. Retrieved from https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/