Is C# code compiled to native binaries?

拥有回忆 提交于 2019-12-22 03:48:08

问题


I know that Java code is compiled into byte-code, that is executed by the JVM.

What is the case with C# ? I have noticed that applications written in C# have the .exe extension what would suggest they are native machine instructions. but is it really so ?


回答1:


No.

Like Java, C# is compiled to an intermediary language (called MSIL or CIL).

Unlike Java, the IL is stored in EXE files which have enough actual EXE code to show a dialog box asking users to install .Net.




回答2:


C# compilation is done in these two steps :

1. Conversion from C# to CIL by the C# compiler

2. Conversion from CIL to instructions that the processor can execute.

A component (just in time) performs this compilation at run time from CIL to machine code




回答3:


What that .exe is supposed to tell you is that the file is executable. C# is compiled into bytecode, just as java is, but .NET wraps this in a CLR executable.

Look here for a more in depth look at CLR executable http://etutorials.org/Programming/.NET+Framework+Essentials/Chapter+2.+The+Common+Language+Runtime/2.2+CLR+Executables/




回答4:


c# code is compiled to MSIL. it likes java bytecode. msil will be convert to machine isntrctions at runtime.




回答5:


C# code is compiled to MSIL, MSIL is taken care by .NET CLR



来源:https://stackoverflow.com/questions/12583514/is-c-sharp-code-compiled-to-native-binaries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!