C # Basic Learning the next day (. NET rookie's growth path-0 Basics to Mastery)

Source: Internet
Author: User

1, the use of the plus sign in our C #, if you want to connect two strings, then we can use the + sign connection.  If there is a string on either side of the plus sign, then the string acts as a connection. If the plus sign is two times the number, then the plus sign plays an additive role.

2, placeholder rules: First dig a hole, and then fill a hole.    {0}: Placeholders are all starting from 0, then increment Note: You dig a few pits, fill in a few pits, fill the no effect.    However, if you fill in less, the program throws an exception. When we output, we output it in the order of digging, not in the order of pits.

3, abnormal so-called anomaly refers to the syntax of the program is not a mistake, but in the process of running a program due to various reasons for errors, resulting in a program crash, can not continue to execute. Various reasons include external factors and internal causes.

4, receive the user input console.readline (): This line of code can receive the user's input in the console, after receiving the completion, we need to store the data that the user entered on the console. Type?  123 123.123 Male 5000m Zhang three we treat all the data that the user has entered in the console as a string type, so we can declare a variable of type string to receive the user's input in the console. Note: We press ENTER to continue the program.

5, three lines of Code Console.WriteLine (); The contents of the parentheses are output to the console.    Console.readkey (): Allows the program to continue regardless of whether the user presses that key.     Console.ReadLine (): Only the user presses ENTER to allow the program to continue.  6, the escape character concept in C #: The so-called escape character refers to a ' \ ' plus a ' special character ' that makes up a character with a special meaning.  \b: Represents the backspace key, which does not work at the end of the string.  \ n: Indicates a newline, only can be wrapped in the console \ r \ n: can be wrapped in the operating system \ ": It is represented as a half-width double quotation mark \ t: tab, making the symbol used in the table.  \ \: is expressed as a ' \ ' Note: ' \ ' does not represent a character, but instead represents the escape @ symbol 1, and cancels ' \ ' in the string escape function, so that it is simply represented as a ' \ '. 2), the string can be exported to the console in the original format of the edit.

7. Arithmetic Operators +-*/% expressions that are concatenated by the arithmetic operator we call it an arithmetic expression. NOTE:---> Two integer type variable subtraction The remainder result is still an integer type---> The simplest way to promote an integer type to double is to multiply by a 1.0---> You can use placeholders to retain the decimal {0:0.00 ...} of the specified number of digits ...} , however, the original value has not changed

8. Type conversion automatic type conversion (implicit type conversion) we require that the type of operands that are involved in the operation on both sides of the equal sign must be the same, and if not, an automatic type conversion (implicit type conversion) occurs if the following conditions are met.  This conversion is what the compiler helps us automate, and we don't need to write extra code.         ---> Two types compatible for example: int and double compatible (both numeric types)---> destination type is greater than source type for example: double > int int number=10;      Double D=number;   Double d=3.14;  int Number=d; Coercion type conversion (display type conversion)---> Two types compatible for example: int and double compatible (both numeric types)---> target type is less than source type for example: double > int However, forcing the type conversion compiler does not help us to do it automatically,  We need to write the code manually to complete it.  The value to convert (the type to be converted);    Forcing the result of a type conversion loses precision.  Whether automatic type conversions or coercion of type conversions we must first satisfy the condition that the data types to be converted are compatible with each other. There are two mutually compatible data types we have learned: Double int

9. Convert type conversion If you encounter type-incompatible data that requires a type conversion, we use the Convert type conversion.    Turn to whoever you like.    Note: We use convert type conversion, avoid, Wannna must go. If the conversion succeeds, the corresponding value is returned, and if the conversion fails, an exception is thrown.

10, the arithmetic operator of the plus and minus Gaga is divided into the pre-+ + and after + +, whether it is the first + + or post-+ +, the end will be added to the variable itself into the pre-and post-, whether before-or after-, will eventually give the variable itself minus one

Note: The difference between Gaga or subtraction in the front and back of a variable is reflected in the time of the engagement operation.

Take Gaga as an example: if it is a pre-Gaga, then you first add one, and then take the value of adding a later to participate in the operation.

If it is post-Gaga, then take the original value to participate in the operation, the completion of the operation and then add one.

For these operators, which require two operands for +-*/%= to operate, we call the two-dollar operator.

For + + or--an operator that needs only one person to complete, we call it a unary operator.

Note: The precedence of the ****** unary operator is higher than the $ two operator.   In an expression, if you have both a unary operator and a two-tuple operator, we should first evaluate the unary operator. Priority: Gaga minus > Brackets > Multiplication > Add-Subtract

Video: http://yunpan.cn/cQCnKnKhzCcg5 access password d598

C # Basic Learning the next day (. NET rookie's growth path-0 Basics to Mastery)

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.