C # keywords

Source: Internet
Author: User

First, most of the C # keywords are listed in the following table:

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

Struct

Switch

This

Throw

True

Try

Typeof

Uint

Ulong

Unchecked

Unsafe

Ushort

Using

Virtual

Void

Volatile

While


 

Context Keyword:

The context keyword is used to provide specific meanings in the code, but it is not a reserved word in C. Some context keywords (such as partial and where) have special meanings 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 constraint)

Where (query clause)

Yield


 

The chart above is copied from: http://msdn.microsoft.com/en-us/library/x53a06bb (v = VS.100). aspx

As you can clearly see, msdn does not properly classify keywords. In this series, it is mainly based on C # And then grouping keywords to help beginners.

 

Keywords used to modify classes, methods, attributes, and fields:

Abstract
New
Override
Virtual
Private
Protected
Internal
Public
Const
Readonly
Sealed
Static
Volatile
Extern
 

Keyword that deals with object type and type conversions:

As
Is
Explicit
Implicit
Operator
Sizeof
Typeof
 

Some Type aliases, special types, and enumeration keywords:

Bool
Byte
Char
Decimal
Double
Float
Int
Long
Sbyte
Short
String
Uint
Ulong
Ushort
Enum
Class
Interface
Object
Struct

 

 

Keyword of the control program flow:

For
Foreach, in
While
Do
If
Else
Switch
Case
Default
Goto
Break
Continue
Return
 

Keyword for exception handling:

Try
Throw
Catch
Finally
Checked
Unchecked
 

Similar to C ++ function pointers and related topic keywords:

Delegate
Event
 

 

Keywords that affect GC collection:

Fixed
 
Keyword of the multi-thread critical area:

Lock
 
Keyword of declared scope:

Namespace
 

Keyword used to control the memory allocation of objects:

New
Stackalloc
 
Keyword that affects method parameter transfer:

Out
Params
Ref
 


Some text values and keywords that reference the current object instance:

Null
False
True
This
Value
 


Keywords related to unmanaged code:

Unsafe
 

Other keywords:

Base
Void
Var
Dynamic

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.