C# to VB.NET: Converting Across the .NET Language Divide
August 10, 2026 · DevTools
C# and VB.NET compile to the same .NET runtime, yet they read very differently. Where C# uses braces to delimit blocks, VB.NET uses keyword pairs — Class/End Class, Sub/End Sub, If...Then/End If, and For/Next. That single difference is the heart of converting between them.
A C# method public int Square(int n) becomes Public Function Square(n As Integer) As Integer; a void method becomes a Sub instead. Variable declarations swap order: int x = 5 becomes Dim x As Integer = 5. Control flow translates too — for (int i = 0; i < n; i++) becomes For i = 0 To n - 1 because VB's For is inclusive. An if/else if/else chain becomes If/ElseIf/Else/End If, sharing one block.
What does not translate automatically is the .NET-specific surface: LINQ expressions, auto-properties, events, and generics all have their own VB idioms. Convert the structure first, then layer those features back in by hand. The result is a working starting point rather than a finished file, but it saves the tedious brace-to-keyword rewrite.