Here is a online converter from telerik which can convert code between vb.net and c# and back to c# from vb.net. It does most of the tough work however it is not perfect. For example the following statement is perfectlly legal in vb.net
txt=num.ToString
When it is converted to C#, the result is invalid code
txt=num.ToString;

  1. Note that C# explicitly requires parentheses after method names even if the method doesn’t take any arguments. Surely the converter should have taken care of it.
  2. Another issue which I encountered while converting code from vb to c# is absents of optional arguments in c#. You would have to make adjustments if you use optional parameters a lot.
  3. Remember to explicitly add
    using System;
    and such commonly used namespaces. It look strange when classes in System namespace like Exception are not recognized.

Remember to verify that the converted code works as well as before — compiling is just not enough!

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList