• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

C# Equivalent to VB Loops

For Loop

VB.NET C#
For i As Integer = 1 To 9
Next i
for (int i = 1; i <= 9; i++)
{
}

For Each Loop

VB.NET C#
For Each s As String In StringList
Next s
foreach (string s in StringList)
{
}

While Loop

VB.NET C#
Do While condition
Loop

or:

While condition
End While
while (condition)
{
}

Do While Loop

VB.NET C#
Do
Loop While condition
do
{
} while (condition)

Loop Until

VB.NET C# (no specific 'loop until' construct)
Do
Loop Until condition
do
{
} while ( ! condition)

Do Until

VB.NET C# (no specific 'do until' construct)
Do Until condition
Loop
while ( ! condition)
{
}


Use Instant C# to convert from VB.NET to C#.     

Additional resource: VB.NET and C# Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.