Automatically Convert C# code to VB.NET

I’ve just put up the first (of many) planned utilities on Developer Fusion – a conversion tool for automatically translating C# code into its VB.NET equivalent.


http://www.developerfusion.com/utilities/convertcsharptovb.aspx


Feel free to take a look, and let me know if you find any problems. The credit is 99.99% due to the guys behind #develop. I’ve simply made this tiny bit of their great application available online, plus added the ability to convert “bits” of classes or methods rather than just whole ones.

12 Replies to “Automatically Convert C# code to VB.NET”

  1. Scott – the source code is available to anyone who asks, and I”ll be making it publicly available when I get the chance.

    Markus has just pointed me in the direction of their latest build, which includes a parser for the reverse process – so I”ll try to get this up later in the week!

  2. Hi,

    I”ve got a c# client application I”d like to

    convert to VB. This is not a web application.

    Will your application be able to convert this?

    Regards,

    Jim

  3. void Application_BeginRequest (Object sender, EventArgs e)

    {

    //

    // TODO: Convert a path of the form

    // …/quotes/page1.aspx into a path of the form

    // …/rewritepath.aspx?id=1

    //

    HttpContext context = HttpContext.Current;

    string oldpath = context.Request.Path.ToLower ();

    string token = "/quotes/page";

    int i = oldpath.IndexOf (token);

    int len = token.Length;

    if (i != -1) {

    int j = oldpath.IndexOf (".aspx");

    if (j != -1) {

    string id =

    oldpath.Substring (i + len, j – (i + len));

    string newpath =

    oldpath.Replace (token + id + ".aspx",

    "/rewritepath.aspx?id=" + id);

    context.RewritePath (newpath);

    }

    }

    }

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.