Lead:
The CPU only recognizes binary code. How does the C # source code become a binary code that can be recognized by the CPU?
The procedure is as follows:
1. C # source code
2. Use the Command Prompt window provided by VS to convert the C # source code into an assembly (EXE or DLL file). The Assembly is mainly composed of MSIL (Microsoft intermediate language, by decompiling the assembly, you can see the Microsoft intermediate language in it.
3. After running the EXE file ,. net framework also starts to run. The (instant compiler) in it (when the common language is running) converts the intermediate language into the CPU instruction of the local platform and sends the instruction to the CPU for execution.
Question:
1. Why is the Assembly not directly converted into binary code? Isn't it faster?
The commands for the same action are different for CPUs of different brands and models. C and C ++ are directly converted to binary, it only compiles the language code into the intersection of different CPUs. NET Program compilation, first judge the CPU asterisks of the Local Machine, JIT converts the intermediate language into a CPU command, can make full use of each function of the current CPU, so, not C, C ++ is more efficient than C #. C # is sometimes more efficient than C and C ++.
2. Can. NET be cross-language?
Yes. VB. NET has a VB compiler to convert the VB language into a Microsoft intermediate language. The rest do not need to be done. The rest do the same.
3. Is. NET cross-platform?
Yes. Use mono.
Figure: