Saturday, July 22, 2006

Loop, Loop....

I had got a relatively small but cumbersome C# code to maintain and extend. Well, I was first charged with the enthusiasm of working in C#, but being a pampered VB (.NET) developer, I decided to convert (manually) the whole code to VB.NET. There were two reasons that made me decide this:

1. I could learn the whole code and what the code intended to do.
2. I was leery on making C# code changes to a working piece of software! Yes, I was too leery!

After 2 days of juggling, I got everything to VB.NET! Wow!

But when I started testing, one part of the code started breaking! :-) This was not expected (It's never expected to fail, right? :-)). I had converted a for loop in the C# code to a for loop in VB.NET.

In the C# code, an arraylist was the one which was getting "looped" and when a condition matched, on object gets removed from the arraylist. The world seemed perfect.
But, to my luck, the VB.NET code did not behave as expected.

Later, I learned that the VB.NET equivalent of the FOR loop in C# is the WHILE loop.

Good learning of the month!

No comments:

Post a Comment