15-07-01 C # language Basics

Source: Internet
Author: User

Input statement:
Console.ReadLine (); --Read keyboard keys
Console.readkey (); --Read input content
Output statement:
Console.WriteLine (writes the string to be output); --Automatic line wrapping
Console.Write (writes the string to be output); --No automatic line wrapping

Three ways to annotate://Comment one line
/**/comment section
Put it on a function and annotate a function.

Data type:

Base data type (value type)
int integer in-memory integer
Double decimal type Save decimal Example: 2.13
char character type storage character example: ' A '
BOOL Boolean type in existence State True&false
DateTime Date Time Type Save date Time Example: 2015-07-01

Complex types (reference types)
String String type

Value types can store data values directly;
The reference type stores an address, reads the address first, and then reads the data that the address points to

Note: Kanji are strings and cannot be converted to int characters
String does not perform mathematical operations
Concatenation between strings with a + representation

Type conversions:

1. Auto-convert (implicit)

Convert.to type name (number to turn);---commonly used in this way
Type name. Parse (number to turn);
(type name) variable: a type of the same large class can be converted with ()

Definition of variable constants:

Type variable name, for example: int A;

Const type constant name, such as const double t = 3.14;

Operator:

1. Arithmetic operator: +-*/% + +--
2. Relational operators: = =! = > < >= <=
3. Logical operator:&& | | !
4. Other operators: + = = *=/=%=?:

15-07-01 C # language Basics

Related Article

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.