-
C# to vb .net (2005) help
help me to convert the following c# code in vb .net (2.0)
do {
while (bl_counts[--incrBitLen] == 0);
do {
bl_counts[incrBitLen]--;
bl_counts[++incrBitLen]++;
overflow -= 1 << (maxLength - 1 - incrBitLen);
}
while (overflow > 0 && incrBitLen < maxLength - 1);
}
what is the meaning of while loop without curly braces in c#
awaiting reply.
Thanks
Javfarary
-
As I mentioned in another forum, the code you posted won't compile - your outer 'do' loop needs some condition (you can't have a conditionless 'do' loop in C#).
Here is an attempt to format your code to determine where your problem lies:
do //this 'do' loop needs a condition (either here or at the end)
{
//this is an empty while loop (perfectly legit):
while (bl_counts[--incrBitLen] == 0);
do
{
bl_counts[incrBitLen]--;
bl_counts[++incrBitLen]++;
overflow -= 1 << (maxLength - 1 - incrBitLen);
} while (overflow > 0 && incrBitLen < maxLength - 1);
//syntax error - you cannot close a simple 'do' loop like this in C#:
}
Regarding the loop without braces, it's just a loop that only executes 'header' logic under the condition is met.
-
Thanks for the help, I got the while loop working in vb now. thanks
and what about this code...
if (windowFilled++ == WindowSize)
{
throw new InvalidOperationException("Window full");
}
if the condition is true then only windowFilled++?
Please convert it to vb.
Thanks
Javfarary
-
'windowFilled' is incremented after the conditional test, regardless of whether the test is true or false.
-
Similar Threads
-
By Jim Underwood in forum .NET
Replies: 3
Last Post: 02-28-2002, 09:45 PM
-
By Jim Pragit in forum .NET
Replies: 64
Last Post: 10-20-2001, 08:06 PM
-
Replies: 214
Last Post: 06-01-2001, 07:27 AM
-
By Jean-Yves in forum Enterprise
Replies: 3
Last Post: 06-01-2000, 12:23 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks