General review of C # Fundamentals 01

Source: Internet
Author: User

Soon to graduate, ready to learn the knowledge of the past few months to comb, here is written in some of the most basic C # things (Daniel do not laugh at me, this is my record of some notes and so on), I hope to help some people are learning this knowledge, if there is not written in the place, hope that the great God guidance.

Start with the basics:

1:c# is a strongly typed language; case sensitive; there must be a definite definition of the type of the variable.

2: assignment Operator "=": the equals sign is not equal in C #, but instead represents an assignment, assigns the value to the right of the equal sign to the variable to the left of the equal sign, and an expression connected by an equal sign, called an assignment expression. Requires that the data types on both sides of the equal sign must be identical.

3: The use of the plus sign: ① connection, when the plus sign on either side is a string, this time the plus sign is the function of the connection. ② Add, when the plus sign is both on both sides of the number, the plus sign is the function of addition.

4: Use of placeholders: Use rules: Dig a hole first, then fill a hole.

Note: Dig a few pits, fill a few pits, more filled, no effect; less filling, program throw abnormal; the output is output in the order of digging pits.

5: Escape character: The so-called escape character refers to a ' \ ' plus a special character that makes up a character with a special meaning.

\b: Indicates backspace key

\ ": A double quotation mark representing an English half-angle
\ n: Indicates line break
\ r \ n: Indicates a line break in the operating system
\ t: The effect is the TAB key on the keyboard
\ \: denotes a ' \ '

@ symbol: Cancel escape: Remove the escape function in the string so that it is simply represented as a ' \ '; Let the code output in the original format of the edit.

6: arithmetic operator: An expression that is concatenated by an arithmetic operator, called an arithmetic expression (which the average person should understand).

+
-
*
/
%

7: Type conversion: In an operation expression, the data type of the equals sign must be identical, and if not, the following two conditions are met; An automatic type conversion can also be an implicit type conversion.

1), both types must be compatible (both numeric) Double int

2), converted from small to large int--->double

The compiler automatically helps us complete the conversion.

8: Forced type conversion or display type conversion

1), both types must be compatible (both numeric) Double int

2), convert the large into a small double--->int

eg

int a = 10;
Double d = 20;
int B = a + (int) D;
Console.WriteLine (b);

Note: Forcing the result of a type conversion loses precision.

9:convert type conversion: Used to handle conversions of type incompatibility.

int type: Convert.ToInt32 (Object);

Double type: convert.todouble (Object);

String:tostring ();

  

Write this point first, will continue to update ...

General review of C # Fundamentals 01

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.