Convert VB.NET --> C# Projects [closed]

2020-05-19 08:55发布

问题:

Can anyone recommend a good application that could be used to convert VB.NET projects to C#, without having to do too much manual work?

We've used Reflector to do small libraries manually, but some of the larger projects will be too slow and complex to do this manually.

回答1:

You can use Lutz Roeders Reflector (http://www.red-gate.com/products/reflector) which can decompile whole Assemblies into Visual Studio projects. This way you can convert from ANY .NET Langauge into one of the supported languages of this program (C#.VB.NET,MC++,Delphi,Chrome)



回答2:

Tangible Software do various converters, including VB to C#.

I've played with it a little bit as they're kind enough to give me a copy for free, but I can't say I've stress-tested it. When I've used it it's been fine though - certainly worth a try.



回答3:

A few things to keep in mind...

1) Depending on how the VB.Net code was written, automatic conversion may or may not be 100% possible. VB.Net allows a "looser" coding style that would be ambiguous to C#. So, some manual intervention may be needed.

2) If the VB.Net code functions correctly, you may want to just leave it as VB.Net. Both VB.Net and C# projects can co-exist within the same solution.



回答4:

The far best tool for this is Econ Netvert which can be found on CodePlex http://www.codeplex.com/econnetvert



回答5:

SharpDevelop has this feature, but I haven't used it enough to know if works reliably. It seems to be a pretty good otherwise, so it's worth a try though.



回答6:

The best and fast converter I have seen so far is http://converter.telerik.com/

Nicely presented using RAD AJAX Controls.

Note: It converts only code snippets and not projects as a whole.



回答7:

There's also the free online converters up at developerfusion :)



回答8:

SharpDevelop is quite good, but at my company we've found VBConversions to provide a much more complete conversion. It's a commerical app though, but for the time saved over SharpDevelop it was a no-brainer for us.

As a specific example, one thing we found that SharpDevelop didn't convert correctly was VB indexes, which use curvy brackets. It seemed unable to distinguish between indexes and method calls so didn't convert the indexes to square brackets. VBConversions converted them fine. This one thing made it worth its purchase for us.

It looks like the Tangible Software product works very similarly to VBConversions.