Code conversion between C# and VB.NET has always been a needed feature for .NET developers, mainly for documentation (noone wants to maintain two sets of code samples) or just for porting functionality in your preferred language.

The first good code converted was created as part of SharpDevelop, then it was moved to RefactoringEssentials as an extension for Visual Studio. The project is still going strong as a standalone project

In this series we will build an online C# <-> VB.NET code converter using Angular and .NET Core.

A simple diagram of our project will be something like this.

Diagram

As a starter we would like to enter this code snippet in the browser

using System;

class Program
{
    public static int Fibonacci(int n)
    {
        int a = 0;
        int b = 1;
        // In N steps compute Fibonacci sequence iteratively.
        for (int i = 0; i < n; i++)
        {
            int temp = a;
            a = b;
            b = temp + b;
        }
        return a;
    }

    static void Main()
    {
        for (int i = 0; i < 15; i++)
        {
            Console.WriteLine(Fibonacci(i));
        }
    }
}

and get this code as a result

Friend Class Program
    Public Shared Function Fibonacci(ByVal n As Integer) As Integer
        Dim a = 0
        Dim b = 1

        For i = 0 To n - 1
            Dim temp = a
            a = b
            b = temp + b
        Next

        Return a
    End Function

    Private Shared Sub Main()
        For i = 0 To 15 - 1
            Console.WriteLine(Fibonacci(i))
        Next
    End Sub
End Class

Additionally we might add authentication to our web app and functionality to share code snippets with others.