Functions and variables

Source: Internet
Author: User

Static and Dynamic

Hml static (Data static)

ASP/ASP. NET Dynamic (Data Dynamics)

 

C # programming:

(1) Project Structure

. Cs -- source file (program code)

. Csproj -- project file (Manage File items)

. Sln -- solution file (manage projects)

. Config -- configuration file

 

Four elements of a function: name, input, output, and processing

 

Main Function

Static void main (string [] ARGs)

{

}

 

Input statement

String S = console. Readline ();

 

Output statement

Consystemic writeline ("content to be output ")

Consystemic wrie ("content to be output ")

Difference between writeline and write: automatic line feed after writeline output

 

(2) Data Types

1. Integer: byte, Int, short, long

2. Float Type: float, double, decimal

3. Character Type: Char (single character, with single quotation marks '')

4. boolean: bool (true, false)

5. string type: string (double quotation marks "")

6. datetime type

 

(3) variables

1. variable naming rules:

1) variable names: letters, numbers, underscores, @, and Chinese characters.

2) the first character can only be letters, underscores, @, and Chinese characters.

3) The name cannot be the same as the system keyword.

2. variable definition:

Data type variable name [= value]

Example: int A = 1

3. Use of variables:

Value assignment, Value

 

(4) Constants

1. Classification: symbolic constants and literal Constants

2. Definition of symbolic Constants

Add the keyword const before variable Declaration

Example: const int A = 3

3. Use of symbolic constants: values cannot be assigned. Values can only be set.

4. escape characters:

'\ T' Tab key character

'\' Backslash

'\ ''Single quotes

'\' Double quotation marks

'\ N' line feed

'\ R' press ENTER

 

Appendix:

; Statement ended

// Comment a row

/* Comment out a region */

Shift + delete a row

CTRL + (K, c) comment the selected row

CTRL + (K, u) uncomment the selected row

Alt + → prompt, change

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.