VB Equivalent to C# For Loops





























VB Equivalent to C# For Loops

C# for loops are potentially far more complex than VB For loops.  For this reason many C# for loops need to be converted by to VB Do While loops.  Only simple C# for loops having a single initializer and a single iterator are converted to VB For loops.

 

For example, the following C# code:

for (int i=9, int j = 1; i > 0 && j < 9; i--, j++)
{
    ...
}
 

converts to the following VB code:

Dim i As Integer = 9
Dim j As Integer = 1
Do While i > 0 AndAlso j < 9
    ....
    i -= 1
    j += 1
Loop

If you need to convert from C# to VB.NET and you are depending on the results being reliable and accurate, then you will want to have Instant VB, the best C# to VB.NET converter, at your fingertips.

 

 
 
Email your questions and comments to:  info@tangiblesoftwaresolutions.com

[Site Map]        [Home]


Copyright © 1997 - 2009 Tangible Software Solutions Inc.