2. Variable expressions and Process Control

Source: Internet
Author: User

This is chapter 3 and chapter 4 of the C # Getting Started classic. Chapter 2 describes the basic knowledge of vs2010, which indicates that it has been read. After lunch, I threw a bottle downstairs for a while and felt a little calm.

1. C # The Compiler does not consider the blank characters in the Code: space, carriage return, or tab. This is a better compiler. It can freely control indentation, line breaks, and other typographical issues, I want to talk about the story of having to make an error when I press enter on the last line while writing the cache.

2. Three Methods of annotation ://,///,/**/. They have their own application scenarios, such as descriptions, key information summaries, and variable prompts. Ide automatically extracts the text in the comments during project compilation and creates a document description, therefore, you must follow the rules of the XML document during writing. Parallel bars are the most commonly used. asterisks are rarely used. It is said that sometimes the compiler is difficult to identify such multi-planet comments.

3. C # case sensitive.

4. Two naming conventions in the. NET Framework namespace: pascalcase and camelcase. They have their own application scenarios. For example, the conventional variables use camelcase, the namespaces and class attributes use pascalcase, and so on.

5. The underline is used as the separator between words in the variable name.

6. the nominal value is probably the direct amount in Js. Int I = 1; 1 is called the literal value-literal [C].

7. String escape: @ "C: \ Temp" and "C: \ Temp ".

8. Operators are divided into one, two, and three elements based on the operands they process. The element is the object.

9. For ++ I and I ++, we will do it first and later. When writing for, changing the counter will not affect the performance, but it does not involve the priority of multiple operators.

10. There are six assignment operators: =, + =,-=, * =,/=, and % =. I will not list others.

11. namespace is a method that provides application code containers in. net. It uniquely identifies the Code and its content and organizes code with specific functions and structures.

12. The namespace can be nested, And the nested namespace is considered two different. NS1 is different from ns1.ns2.

13. The name is uniquely defined by the namespace. It means that the names in the same namespace cannot be repeated and the names in different namespac are irrelevant.

14. The using ns in namespace and namespace can have the alias using newname = NS.

15. Naming rules for variables: I. The first character must be a letter, underline, or @; II. It can be followed by letters, underscores, or numbers. This kind of description provides the available ideas when dealing with some practical problems. The solution is divided into the first one and the rest.

16. variable of the string type uses variable-size memory. The memory of other variables is fixed. The number can be 8 to 64 bits. sbyte (byte), short, Int, and long are unsigned accordingly.

17. boolean operators are Relational operators.

18. & |, conditional boolean operator & ||,& the operation result is exactly the same as that of &. write an article about bitwise operators separately.

19. Goto label; label: Statement; used with caution or not.

20. The declaration of constants requires the keyword const, and the variable type must be assigned a value at the same time. It can only be used later and cannot be changed.

21. Process Control: What is the operator of the three orders? :, If, switch, Goto.

22. There are many ways to jump out of the case in the switch: Break, return, throw, Goto.

23. There are four types of loops: Do-while;, while, for, and foreach. Note that the for counter is defined in for as part of.

24. The foreach set is a read-only attribute and cannot be added or removed. The error collectioin was modified; enumeration operation may not execute is because the ienumerator returned by the collection exposes the current attribute as a read-only attribute, so modifications to it may cause runtime errors, you just need to change foreach to for traversal.

25. there are four methods for loop interruption: Break-terminate the loop immediately; Continue-terminate the current loop immediately and continue the next execution; goto-jump out of the loop to the mark, and the Goto jump into the loop is invalid; return-jump out of the loop and Its contained functions. Avoid infinite loops-endless loops.

So finally, this book now shows that every sentence can come up with some programming scenarios. Although I have accumulated a small amount of code, I feel a few points. To continue writing, continue reading.

2. Variable expressions and Process Control

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.