转换C#知识VB.NET任何潜在的问题?知识、问题、VB、NET

2023-09-02 21:53:47 作者:疏影柏翠胭脂淡

我有一个团队,人是相当舒适在C#中,但我们得到了一个要求写在VB.net项目。如何很难会是想在C#和动态转换为VB? 是不是可行?

I have a team with people that are quite comfortable in C# but we got a requirement to write a project in VB.net. How hard would it be to think in C# and on the fly convert to VB? Is that doable?

您可以列出的问题,我们能遇到?

Could you list the issues that we can come across?

我听说VB.net没有关闭。是,.NET 3.5仍然如此?

I heard that VB.net doesn't have closures. Is that still true for .net 3.5?

推荐答案

如果您正在接近VB.Net与C#的心态,最好设置以下选项中的项目

If you are approaching VB.Net with the mindset of C# it's best to set the following options in the project

选项严 在显式的选项在 选项推断在

这基本上消除VB.Net并迫使它是一个严格的类型语言的后期绑定语义。这将使它更接近于C#语义明智的(还没有确切的以任何方式)。

This essentially removes the late binding semantics of VB.Net and forces it to be a strictly typed language. This will make it closer to C# semantic wise (still not exact by any means).

VB.Net有LAMBDA防爆pression(并因此关闭)的支持开始与Visual Studio 2008 / .NET Framework 3.5的版本。不前pression而不是语句。不支持,直到VS2010 / .NET Framework 4.0中lambda表达式。虽然你可以使用4.0编译器downtarget 2.0框架。

VB.Net has Lambda Expression (and hence Closure) support starting with the Visual Studio 2008 / .Net Framework 3.5 release. Not expression and not Statement. Statement lambdas are not supported until VS2010 / .Net Framework 4.0. Although you can use the 4.0 compiler to downtarget 2.0 frameworks.