C # language Summary 1

Source: Internet
Author: User

c#c# definition: 

C # is an object-oriented, component-oriented language that is part of. Net.

Program Structure:

Name space

Class

Property

Method

Main function entry

}

Data type:

C # Data types are divided into: value type (value types), reference type (Reference types), pointer type (Pointer types)

value types : Store them and content on the stack

Boolean value: BOOL,

Characters: Char,

Decimal: Float, double, decimal

Signed integers: sbyte, short, int, long

Unsigned number: Byte, uint, ULONG

Infrequently used: Ensum (enum), struct (struct)

The detailed scope of each data type is as follows:

reference Types : Store objects in the heap, store references in different places, mainly related to objects, etc.

class -related objects, such as object,string (string is an alias of string), and class

Interface: interface

Arrays: such as: int[]

Commissioned by: Delegate

pointer type :

Pointers in C # have the same functionality as pointers in C or C + +. such as: int* P;

Common knowledge:

Escape characters :

Mathematical operators :

Subtraction: + 、-、 *,/(Division sign will calculate the result with the most accurate parameters, if all integers, the fractional part will be shed, such as: 3/2.0 = 1.5,3/2 = 1)

exponentiation: ^

Self-increment/decrement: + + 、--

Modulus:%

All operators and precedence are as follows:

Basic Statement :

Statement: int/char/string name;

Judgment: If

Loops: While, for, do while, foreach

Select: Switch

Jump Out (less)/interrupt/Loop Skip: Goto, break, continue

Function:

Two key words
Static
Acting on variables: allocating memory at compile time, releasing at end of program
Function: This function is only visible within this file
void: No type, used when the function does not require arguments or return values

Static <returnType><FunctionName><paramType> <paramName>,...)
{
Logic
Return <returnValue>;
}

C # language Summary 1

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.