After learning C # And. Net for so long, I have been blind. I have learned about. net, C #, CLR, JIT, and IL recently. I hope to help students understand. net.
(The level is limited. Hope you can give me more advice)
Concepts
What is. Net?
. Net Framework (. net Framework) is developed by Microsoft, a company dedicated to agile software development and rapid application development) software Development Platform (derived from Wikipedia) with platform independence and network transparency ).
. NET is not a language. In a narrow sense, it can be a framework for running a language. NET is based on CLR (Common Language Runtime. It supports C #, VB, C ++ and other languages, or this sentence can be misunderstood. In fact, CLR does not directly run these languages, instead, run the intermediate language il generated by these languages (described later ).
What is CLR?
CLR (Common Language Runtime, General Language Runtime Library) is. the core of the net platform, similar to Java's JVM function, is also called CLR. net Virtual Machine, as mentioned earlier, CLR is a runtime environment, responsible. net runtime process thread management, resource management and type encapsulation.
JIT: Real-Time compilation.CodeCompiled into an instruction set that can be directly executed on the local machine.
In layman's terms, CLR is the operating environment of Il, JIT is the Il compiler, and Clr and IL affect. net.ProgramThe main factor in execution efficiency.
What is Il?
Intermediate language can be understood as an assembly of the. NET platform and supports object-oriented features. Let's take a look at helloworld.
Using system; namespace helloworld {class program {static void main (string [] ARGs) {console. Write ("helloworld! ");}}}
Generate it, and open the Il anti-assembler to disassemble the helloworld program.
Double-click the main method to view the Il instruction set.
. Method private hidebysig static void main (string [] ARGs) di-managed {. entrypoint // code size 13 (0xd). maxstack 8 il_0000: NOP il_0001: ldstr "helloworld! "Il_0006: Call void [mscorlib] system. Console: Write (string) il_000b: NOP il_000c: Ret} // end of method program: Main
This is the command that the CLR can run. It is equivalent to the C language. To run the C code, you must first compile the C code into an assembly command and then run it on the machine. Learning il helps you understand. NET and CLR in depth.
What is C #?
The object-oriented advanced programming language should not be unfamiliar. However, C # is not equal to. net. C # is the most widely used programming language on the. NET platform. In addition to C #, you can also use VB, C ++, F # and other development languages. These languages are compiled into il code and executed in CLR. If you understand the compilation principle, you can even apply Java. you can also set your own language. All you need to do is compile and convert the code of the language you set into executable il instruction sets.
Illustration. net
The code you wrote on the. NET platform is executed in this way. Understand this image and go back to the above concepts or make it easier.