C# Keywords


Identifiers

  • An ID is a name for a class, variable, feature, or any other user-defined item. The fundamental guidelines for naming C# classes are as follows-
  • A letter, followed by a series of letters, numerals (0-9), or underscores must begin with the name. A digit cannot be the initial character in an identifier.
  • ?, -, +, !, @, #, %, ^, &, *, (, ), [, ], {, }, ., ;, :, ", ', /, and \ shall not contain embedded spaces or symbols, Underwriting (_) can however be utilised.

C# Keywords

Keywords are predefined words for the C# compiler reserved, and I cannot use these terms as identifiers. You can, however, prefix the term with the @ character if you want to utilize these keywords as identifiers.

In C#, certain identities have a unique significance in code context as contextual keywords, such as to get and set.

The table below includes the keywords and contextual keywords reserved for C# -

Reserved Keywords:

abstractasbaseboolbreakbytecase
catchcharcheckedclassconstcontinuedecimal
defaultdelegatedodoubleelseenumevent
explicit externfalsefinallyfixedfloatfor
foreachgotoifimplicitinin (generic modifier)int
interfaceinternalislocklongnamespacenew
nullobjectoperatoroutout (generic modifier)overrideparams
privateprotectedpublicreadonlyrefreturnsbyte
sealedshortsizeofstackallocstaticstringstruct
switchthisthrowtruetrytypeofuint
ulonguncheckedunsafeushortusingvirtualvoid
volatilewhile

Contextual Keywords:

addaliasdescendingdynamicfromget
globalintojoinletorderbypartial (type)
partial(method)selectset