Is there a library that I can use to convert VB.Net code into C#? There is http://codeconverter.sharpdevelop.net/ but i don't want to use it from a web service.
-
1The notes say that service is based on code from this project http://www.icsharpcode.net/opensource/sd/ - you could download that and reimplement locally? Or contact sharpdevelop.net and ask them if you can licence their converter for local use? – Rup Jul 21 '10 at 11:29
3 Answers
Open your assembly in .NET Reflector. Choose language C#. Copy/paste source code to Visual Studio. Try to compile.

- 98,240
- 88
- 296
- 433
There are plenty online services: Telerik provides one, here's one other and one of the best is on developer fusion. But these are all online.
I've had good experiences with Instant C# of Tangible Solutions, they provide good services for each bug you encounter after conversion. Other than that, many others are available through Google.
If you use Reflector, a few notes: it doesn't translate your source code, but the compiled code. This can make a huge difference in logic inside methods and above all, you loose all your (xml) comments and possibly your file structure (partial classes are not recognized, for instance). Reflector is virtually unusable when it comes to ASPX and inline code. But it is an excellent free tool in all other respects

- 65,241
- 13
- 115
- 165

- 56,041
- 24
- 146
- 247
Just download SharpDevelop 4.4, it contains the same converter for offline use.
Actually, the SharpDevelop converter is even better than the online converter as it can take a look at your whole project and your references.
The SharpDevelop source code repository also contains the full source code for that website. It's all open source.

- 15,944
- 2
- 54
- 60
-
A quick test says VB.NET to C# conversion not working in #develop 5.0 beta (not yet). Worked great for me using 4.4.1. Install via Chocolatey: `cinst sharpdevelop`. http://chocolatey.org/packages?q=sharpdev – yzorg Jan 29 '14 at 02:38
-
Yes, pretty much everything related to VB was dropped from #develop 5.0. Considering that we would have to reimplement code conversion from scratch in the new architecture, it is highly unlikely that this feature will be added back. – Daniel Jan 29 '14 at 19:27
-
I saw the VB.NET language service was lagging, thought that was just the IDE integration, not the core stuff used for conversion. Thanks for the info. So the menu item (under Tools-Convert) is going to be removed? – yzorg Jan 29 '14 at 20:02
-
Yes, that will be removed. In SharpDevelop 4, the C# and VB parsers were using a common syntax tree, so we basically got a (badly working) code converter for free (and then improved on that). In SharpDevelop 5, C# got a brand new syntax tree (NRefactory 5), and we don't even have a VB parser anymore. – Daniel Jan 29 '14 at 21:22