简体   繁体   English

IS VB.NET比C#更便携吗?

[英]IS VB.NET more Portable than C#?

My Computer Science Professor told me that VB.NET is more portable than C#. 我的计算机科学教授告诉我,VB.NET比C#更便携。 Is this true? 这是真的? I read that both C# and VB.NET are compiled to the same intermediate code. 我读到C#和VB.NET都编译成相同的中间代码。

If by portable you mean will it run on more hardware and operating system platforms than C#, the answer is no. 如果通过便携式,你的意思是它将运行在比C#更多的硬件和操作系统平台上,答案是否定的。 VB uses the same runtime platform that C# does, and supports the same hardware and operating systems. VB使用与C#相同的运行时平台,并支持相同的硬件和操作系统。

If by portable you mean it has better language interoperability, the answer is still no. 如果通过便携式表示它具有更好的语言互操作性,答案仍然是否定的。 VB.NET has things like case insensitivity that make it less interoperable (within the .NET framework) than C#. VB.NET有类似的事情不敏感的情况下使其不太互操作(.NET Framework中)比C#这一点。

I'd like to know how your professor justifies such a statement. 我想知道你的教授如何证明这样的陈述。 Yes, they both compile to the same IL. 是的,他们都编译到同一个IL。 Once compiled, there's no difference between the two. 编译完成后,两者之间没有区别。 It's also generally as easy to compile one as it is the other, since their respective compilers are generally packaged together. 它通常也很容易编译,因为它们各自的编译器通常打包在一起。 I can't really think of any "portability" advantage of VB over C#. 我无法想到VB相对于C#的任何“可移植性”优势。

C# is more portable. C#更便携。 It can be used with the Mono project to be used on mac, iphone, etc. Last time I checked, you couldn't do that with VB. 它可以与Mac,iphone等上使用的Mono项目一起使用。上次我检查时,你不能用VB做到这一点。

The only way it would be more portable would be if the BASIC language in general somehow outlived C-style languages years down the road. 唯一可行的方法是,如果BASIC语言在某种程度上以某种方式在某种程度上超过了C风格的语言。 That's a dubious prospect at best. 这充其量只是一个可疑的前景。 I'd say that if not for the success of Visual Basic in the 1990's, BASIC would have been long gone from the scene. 我想说,如果不是因为1990年代Visual Basic的成功,那么BASIC早就应该离开现场了。

Portability is typically associated with the computer programming languages capability of being compiled in different hardware platforms with minimal or no changes to the original source code. 可移植性通常与计算机编程语言相关联,该能力是在不同的硬件平台中编译的,对原始源代码的改变很小或没有。 Take the C language as an example. 以C语言为例。

Vb.net and C# are not native languages and can hardly be associated with being portable, UNLESS the .net framework could be run on systems other than windows and then your programs could be compiled AND run on those other systems; Vb.net和C#不是本地语言,很难与可移植相关联,除非.net框架可以在Windows以外的系统上运行,然后您的程序可以在其他系统上编译和运行; both languages would be considered portable then. 这两种语言都被认为是便携式的。 As long as they can only be compiled and run through the .net framework which only runs on windows, what portability have we got here? 只要它们只能通过仅在Windows上运行的.net框架进行编译和运行,我们在这里有什么可移植性?

Ask your professor where has he seen a vb.net or c# program ported to other computer systems? 问你的教授他在哪里看到过移植到其他计算机系统的vb.net或c#程序?

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM