C# keywords

C# keywords

C# keywords are predefined, reserved identifiers that have special meanings to the compiler. You cannot use it as a variable name, constant name etc.
C# keywords cannot be used as identifiers in your program unless they include @ as a prefix.

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      

Contextual keywords

Contextual keywords in c# have special meaning only in a limited program context and can be used as identifiers outside that context. In General, as new keywords are added to the C# language, they are added as contextual keywords in order to avoid breaking programs written in earlier versions.

add alias ascending
async await by
descending dynamic equals
from get global
group into join
let nameof notnull
on orderby partial (type)
partial (method) remove select
set unmanaged (generic type constraint) value
var when (filter condition) where (generic type constraint)
where (query clause) with yield

2021-10-03