问题描述
有很多矛盾的这方面的信息的。虽然有人说C#编译(因为它在运行时被编译成IL,然后以本地代码),有人说其解释为需要.NET。 EN维基说:
There is a lot of contradicting information about this. While some say C# is compiled (as it is compiled into IL and then to native code when run), others say its interpreted as it needs .NET. EN Wiki says:
很多的解读语言首先被编译成某种形式的虚拟
机器码,然后解释的或在运行时
为本地代码编译。
所以,我很困惑。谁能解释清楚?
So I am quite confused. Could anyone explain clearly?
非常感谢
推荐答案
C#是编译成IL,由C#编译器。
C# is compiled into IL, by the c# compiler.
然后,这个IL编译刚刚在时间,因为它的需要,到主机的本地汇编语言(JIT) 。这将有可能写出解释IL虽然不是.NET运行库。即使这样做,我仍然认为,C#是编译型语言。
This IL is then compiled just-in-time (JIT) as it's needed, into the native assembly language of the host machine. It would be possible to write a .NET runtime that interpreted the IL instead though. Even if this was done, I'd still argue that c# is a compiled language.
这篇关于是C#部分解释还是真的编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!