开发者

Visual Studio and .NET programming

I just want to ask whether I am right or not about .NET. So, .NET is new framework that enables you to easily implement new and old windows functions. It is similar to java in the way that its also compiled into "bytecode", but its name is Common Language Infrastructure, or CLI. This language is interpreted by .NET Framework, so code generated by programming using .NET cannot be executed directly by CPU. Now, few languages can be compiled to CLI. First, it was Microsoft-developed C#, than J#, C++ others. I suspect that this is in g开发者_Go百科eneral right, at least I hope I understand it right.

But, what I am still missing is, can you write to machine code compiled code in C#? And, if using Visual Studio 2005, when I select Win32 project, it is compiled into machine code, so only thing you need to run this apps are windows dynamic-link libraries, since static libraries code is implemented into app during linking phase. And those dynamic-link libraries are implemented in every windows installation, or provided by DirectX installations.

But when I select CLR in Visual Studio 2005, than app is compiled into CLI code, and it first executes .NET framework, and than .NET framework executes that program, since its not in machine code.

So, I am right? I ask because you can read these infos on the internet, but I have no one to tell me whether I understand it right or not. Thanks.


  • CLI is not interpreted by the .NET framework, but normally compiled. Pure interpretation wold be too slow.
  • C#, J# etc. came at the same time. In fact, J# originates in Microsoft J++.... so one can say it was there earlier. C++ was also there before, you possibly mean Managed C++ (NOW: C++/CLI). I think that was done same time - in parallel. There are more than 2-3 people working at microosft ;)
  • You can not write C# to machine code. A win32 project is native C++ (i.e. the version not using the .NET runtime).


.NET's first IDE came 2002, so .NET is eight years old. A whole eternity ;)

.NET started with C#, Basic and J# as well as C++. Many other languages followed, for example in the field of dynamic languages IronRuby. With C# and Basic there is no option to generate code that does not require the .NET framework, with C++ you have that option. So no, with the standard tools you can't compile C# to machine code.

There are things to optimizes runtime (pre JITting the assembly, have a look at ngen). It's jitted and not always interpreted, so it's a way faster than a VB script for example. This isn't usually done each time but the first time executing one assembly or with ngen while installing an application.

HTH, -sa

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜