[C # tips] C # some confusing concepts

Source: Internet
Author: User

I have been reviewing the basic knowledge of C # Over the past few days, and I have also found that I have not understood and confused the concept before. Now I will share my Notes: 1. What are the important components of the. NET platform? 1) FCL (so-called. NET Framework class library) these classes are defined by Microsoft in advance. For example, when we create a new windows form application, VS will automatically generate the following code: using System; using System. collections. generic; using System. text; these are the class libraries that Microsoft defined for programmers in advance. Programmers can use it directly. 2) CLR (the so-called common language runtime) is used to create a necessary environment for deploying. NET programs. You can use C #, F #, VB, and other languages to create. NET applications. At this time, a public language specification is required to interpret different languages as something. NET FramWork knows. 2. What is an assembly Assembly mainly composed of MSIL (the so-called Microsoft intermediate language, mainly composed of dll files) programs in different programming languages are. NET FrameWork is compiled into an assembly (dll file). When the program needs to be executed, it uses the JIT (timely compiler) in the CLR to compile the code and send the instruction to the CPU for execution. There are two types of assemblies: .dlland .exe files (but not all dll and exe are called assemblies). For example, we create multiple applications or class library files in the same solution. These programs or class libraries will become different sets after compilation. They are independent of each other. To access each other, add a reference. 3. Differences between Parse conversion and Convert conversion 1) Parse conversion ① Parse conversion can only Convert string ② the independent variable is the specified data type before conversion is successful. NET Reflector compiled source code 2) Convert conversion ① other types can be converted (such as: Class) ② the difference with Parse is that before conversion, the converted object will be judged, if the object is null, the conversion will fail: copy the code class Program {static void Main (string [] args) {string a = Console. readLine (); // Parse can only Convert the string int B = Int32.Parse (a); // Convert can Convert objects such as ParseNumber parNum = new ParseNumber (); // The Compiler reports an error. // int B = Int32.Parse (parNum ); Int c = Convert. toInt32 (parNum); Console. writeLine (B); Console. writeLine (B. getType (); Console. readKey () ;}} class ParseNumber {private int nunm; public int Num {get; set ;}} copy code 4, data type storage location 1) data Types stored in the stack all numeric types, char, bool, enumeration, struct 2) stored in the heap string, array, class tube these types, their variable declarations are all stored in the stack, real objects are stored in the heap, and the variable storage in the stack is called the object address. The following is an array to briefly discuss this problem: // declare a one-dimensional array int [] arr = new int [4]; so what is the execution sequence of this expression? ① The program will first open up a space of the int [] type named arr in the stack. ② then open an int [] object in the heap, the object contains four consecutive Memory Spaces. ③ the return type of the object in the heap is the address, that is, the address returned by the new int [4] expression.

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.