Why wouldn't it be converted to a for loop? Seems a lot closer to the
original to me...

Dim j as Integer = ledCount
For i as Integer = 0 to ledCount
        j -= 1
Next

--Mark Brackett

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Ritchie
Sent: Friday, February 23, 2007 2:49 PM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] pls help convert nested(?) for loop

Actually, I didn't notice the use of Interlocked.Increment
and .Decrement.  C# makes no guarantees that the ++ operator is thread-
safe.  I'm not sure why the author of that converter would write it that
way.

If you don't want the Interlocked methods you could rewrite the C# as
follows:
for(int i=0, j=ledCount; i<ledCount; i+=1, j-=1)
{
}


for which the result will be:
Dim i As Integer = 0
Dim j As Integer = ledCount
While i < ledCount
 i += 1
 j -= 1
End While

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to