views:

26

answers:

4

I know there are tools to migrate VS 2008 application to VS 2010. But anyone knows a tool that can also convert VB.NEt code to C# code.

+1  A: 

Load an assembly up in Reflector and you can get a disassembly in C#.

It will not be perfect, as it works off the IL (which is lower level than C# or VB.NET), so you end up with funny iterator blocks and strangely named variables (that may be illegal names in C#). These patterns are pretty easy to figure out and fix, though time consuming.

Oded
Thanks I will try that out! I was thinking something along the conversion that gives option. But I guess MS does not provide converting the solution as well as the language at the same time.
azamsharp
+1  A: 

Yes, there are tools out there that do this. A simple google search will avail you well.

However, in my experience, the tools that are out there that do this don't do it well at all. Even the best ones aren't worth what you pay for them. They mangle your code, they leave dependencies on the Microsoft.VisualBasic namespace, and they generally leave you with a serious case of buyer's remorse (even if you didn't pay a dime).

Mike Hofer
+1  A: 

I recently had to convert 6 months worth of code from vb.net to C#. Based on a blog by Scott Hanselman I checked out the online code convertor from Telerik. The conversion itself took seconds. About 8 hours later after some manual fixes, I had a fully compiling C# code base. Not bad for 6 months worth of code. And best of all is that it's a free tool.

Check out the online conversion tool here or the more useful batch convertor here.

CletusLoomis
A: 

This one is pretty good: http://www.developerfusion.com/tools/convert/vb-to-csharp/

Brad