C# Macro Recorder

Well, not quite. via Unhandled Perception, it’s the Code Converter.

Convert VB to C# or C# to VB


Sub ConvertCode()
    Dim i As Long
    Dim x As Double
    For i = 1 To 100
        x = x + (i ^ 2)
    Next i
End Sub


void ConvertCode(){

    long i;    double x;

    for (i = 1; i < = 100; i++) {        x = x + (Math.Pow(i, 2));    }


//Service provided by Telerik (www.telerik.com)
//Conversion powered by NRefactory.//Built and maintained by Todd Anglin and Telerik

Posted in Uncategorized

4 thoughts on “C# Macro Recorder

  1. Odd it didn’t convert the statement inside the for loop to

    x += Math.Pow(i, 2);

    That is, if C# includes C/C++’s #= operators, where # is a placeholder for any of C/C++’s dyadic operators. Also very odd it litters code with redundant parentheses. Or does C# give higher precedence to + than the class/structure member operator . ?

  2. First thing I tried, I got

    // ERROR: Not supported in C#: WithStatement

    Shame, all my code is littered with Withs.

  3. OK, what’s a line in C? I forget…my last C code was in ’96.

    I pasted in some code, and got:

    CONVERSION ERROR: Code could not be converted. Details:

    – line 11 col 19: “;” expected

    Please check for any errors in the original code and try again.

    Line 11, as my editor counts it, is completely white space. And no line ends at 19 except an #include.


Leave a Reply

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