Sunday, June 9, 2013

C# Keywords

C# Keywords

Keywords are reserved words predefined to the C# compiler. These keywords cannot be used as identifiers, however, if you want to use these keywords as identifiers, you may prefix the keyword with the @ character.
In C# some identifiers have special meaning in context of code, such as get and set, these are called contextual keywords.
The following table lists the reserved keywords and contextual keywords in C#:
Reserved Keywords
abstractasbaseboolbreakbytecase
catchcharcheckedclassconstcontinuedecimal
defaultdelegatedodoubleelseenumevent
explicitexternfalsefinallyfixedfloatfor
foreachgotoifimplicitinin (generic
modifier)
int
interfaceinternalislocklongnamespacenew
nullobjectoperatoroutout
(generic
modifier)
overrideparams
privateprotectedpublicreadonlyrefreturnsbyte
sealedshortsizeofstackallocstaticstringstruct
switchthisthrowtruetrytypeofuint
ulonguncheckedunsafeushortusingvirtualvoid
volatilewhile
Contextual Keywords
addaliasascendingdescendingdynamicfromget
globalgroupintojoinletorderbypartial
(type)
partial
(method)
removeselectset

No comments:

Post a Comment