C# Keywords

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:

abstractbaseasboolbreakcatchcase
bytecharcheckedclassconstcontinuedecimal
privateprotectedpublicreturnreadonlyrefsbyte
explicitexternfalsefinallyfixedfloatfor
foreachgotoifimplicitinin (generic modifier)int
ulongushortuncheckedusingunsafevirtualvoid
nullobjectoperatoroutout (generic modifier)overrideparams
defaultdelegatedodoubleelseenumevent
sealedshortsizeofstackallocstaticstringstruct
switchthisthrowtruetrytypeofuint
abstractbaseasboolbreakcatchcase
volatilewhile

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:

addgroupascendingdescendingdynamicfromget
globalaliasintojoinletselectset
partial (type)partial(method)removeorderby
Next TopicC# If-else




Latest Courses