Keywords are predefined, reserved identifiersthat have special meanings to the compiler. They cannot be used as identifiersin your program unless they include @ as a prefix. For example, @if is a valid identifier but if is not because if is a keyword.
Thefirst table in this topic lists keywords that are reserved identifiers in anypart of a C# program. The second table in this topic lists the contextualkeywords in C#. Contextual keywords have special meaning only in a limitedprogram context and can be used as identifiers outside that context. Generally,as new keywords are added to the C# language, they are added as contextualkeywords in order to avoid breaking programs written in earlier versions.
|
A contextual keyword is used to provide a specific meaning in thecode, but it is not a reserved word in C#. Some contextual keywords, such as partial and where, have specialmeanings in two or more contexts.