C ++ and. netProgramTwo different compilation methods are used. Generally, a program written in C ++ is compiled into binary at a time.CodeAnd can be directly executed on the corresponding operating system platform. However. net program uses the method of two compilations, using C #, VB. programs Written in languages such as net are compiled into il code, and compiled into local binary code by running the clr jit.
I personally think that the differences between MFC and winform are basically caused by differences in the compilation mode. Therefore, before carefully exploring MFC and winform, it is necessary to take a closer look at the changes brought about by different compilation methods.
Consider a piece of code. It needs to generate different code in different compiling environments, or replace similar code with some replacement methods to reduce the amount of code writing. Use pre-compilation and Macros in C ++ to solve these problems. In the MFC framework, a large number of macros are used to design core functions. However, macros are just a clever way to reduce the amount of input code. They are essentially no different from writing some code (maybe not strict enough ), it cannot dynamically support code insertion and modification when the program is running, because it has been compiled. The secondary compilation is different. You can regard the first compilation as the pre-compilation period of a General Compilation Program, but this pre-compilation is more powerful, it can compile and generate richer metadata. In addition, as long as the code is inserted dynamically before JIT execution, reflection and other means can be used to change the behavior of compiled programs to some extent, its Dynamic performance has basically changed.
Therefore, in MFC and winform, we can see that the two are very different in dynamic performance, security, and efficiency. To sum up, it can all be attributed to the different compilation modes. You can see these differences in future logs.