自己UP,希望有人看到。TKS!

解决方案 »

  1.   

    答:
    1,第一次发生在我们编译程序时.
    2.发生在我们执行之前,CLR把IL即时编译为机器码,并执行.对于WINDOWS桌面程序,第2步,在你每次执行程序时,都是要发生的,就是说,每一次执行程序,CLR都要即时把IL编译成机器码.不过,你可以用.NET提供的一个工具把IL转换成机器码.对于ASP.NET程序,程序编译好后是缓存在机器中的,当修改程序后,才会重新编译.
      

  2.   

    “你可以用.NET提供的一个工具把IL转换成机器码”
    请问是什么工具?在哪儿?TKS
      

  3.   

    Native Image Generator (Ngen.exe)
    The Native Image Generator creates a native image from a managed assembly and installs it into the native image cache on the local computer. The native image cache is a reserved area of the global assembly cache. Once you create a native image for an assembly, the runtime automatically uses that native image each time it runs the assembly. You do not have to perform any additional procedures to cause the runtime to use a native image. Running Ngen.exe on an assembly allows the assembly to load and execute faster, because it restores code and data structures from the native image cache rather than generating them dynamically.
    具体参考MSDN