C # Study Notes (September April 3)

Source: Internet
Author: User

The Common Type System has a set of built-in data types. It provides Common standards for. NET language definition variables, usage variables, and management variable types.

The C # Type can be divided into two categories: one is the real Value Type, which can never be null when configured in the stack; the other Type is Reference Type, which is configured in Managed Heap. C # Is a type-safe language and cannot be used before the variable is initialized.
 
It is important to understand the relevance and priority of the C # operations, and to help write the Application Operation Process and the debugging of the application.

You can use the conversion operands to explicitly convert the type to another type, but you must note whether there is an overflow problem during the conversion so that the program can be executed more stably.

C # provides many statements that can be used to control program processes. Common selection statements: if and switch determine whether to execute program code with specific values or statements. Repeated statements: for example, while, do, for, and foreach can repeatedly execute program code in a certain segment. Jump statement: such as goto, break, and continue, used to control the Conversion Program.

If the application can be executed more stably, you must handle exceptional errors carefully when writing the program to avoid unexpected actions during user operations, for example, when opening a non-existent file, the program will encounter an endless loop. When an error occurs in C # application execution, the system generates an exception error. You can use try… in C... Catch errors and prompt user instructions as appropriate. If the error handling provided by the System cannot meet the requirements of the program designer, you can inherit the System. Exception class and write the Exception handling class by yourself.

Using System; class Method {public static void MyMethod () {Console. WriteLine ("this is a Method, but a collection of C # Code ."); Console. writeLine ("methods have different names in different languages: functions, subprograms, etc.");} public static int Main () {Console. writeLine ("this is also a method. Main, WriteLine, and MyMethod are the three methods of this Code"); MyMethod (); Return 0 ;}}
All methods in C # belong to a class, which is similar to other programming languages (such as C, C ++, and VB) that allow global functions and global sub-programs ), not the same.

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.