A keyword is a predefined identifier reserved for the compiler. They cannotProgramIs used as an identifier, unless they have@Prefix. For example,@ IfIs a valid identifier,IfNo, becauseIfIs a keyword.
The keywords listed in the first table in this topic are reserved identifiers in any part of the C # program. The second table in this topic lists the context keywords in C. A context keyword has a special meaning only in the context of a restricted program and can be used as an identifier outside the context. Generally, when adding new keywords to the C # language, they are also added as context keywords to avoid damaging programs written in earlier versions of the language.
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 |
In (generic modifier) |
Int |
Interface |
Internal |
Is |
Lock |
Long |
Namespace |
New |
Null |
Object |
Operator |
Out |
Out (generic modifier) |
Override |
Params |
Private |
Protected |
Public |
Readonly |
Ref |
Return |
Sbyte |
Sealed |
Short |
Sizeof |
Stackalloc |
Static |
String |
Structure |
Switch |
This |
Throw |
True |
Try |
Typeof |
Uint |
Ulong |
Unchecked |
Unsafe |
Ushort |
Using |
Virtual |
Void |
Volatile |
While |
|
Context keyword
The context keyword is used to provideCodeBut it is not a reserved word in C. Some context keywords (suchPartialAndWhere) Has a special meaning in two or more contexts.
Add |
Alias |
Ascending |
Descending |
Dynamic |
From |
Get |
Global |
Group |
Into |
Join |
Let |
Orderby |
Partial (type) |
Partial (method) |
Remove |
Select |
Set |
Value |
VaR |
Where (generic type constraints) |
Where (query clause) |
Yield |
|
See
Converted from msdn original http://msdn.microsoft.com/zh-cn/library/x53a06bb.aspx