It’s about the way you think about programming. This isn’t another debate on which language is better. Just noting the differences because of how I think. The first is…
After I think through the logic I want, the first thing that comes to mind might be “I need an integer”. This works well:
This, not so much:
Dim i As Int32
In C#, the name of the variable is secondary, at least at the point when it’s created. I need an integer. I don’t really care what its name is (yet). Nor does the compiler.
In VB.NET, I have to come up with a name. And if my RPG days are any indication, I take a long time coming up with names. By the time I think up an appropriate name, I forgot what type it’s supposed to be.
It’s like the active-passive voice in English. “He ate the apple.” and “The apple was eaten.” Which do you want to focus on?
In C#, arrays are declared like so:
int ia = new int;
In VB.NET, they are declared like so:
Dim ia(5) As Int32
There’s a catch though. The array in C# has 5 elements. The one in VB.NET has 6.
Both languages treat arrays with zero-based indices. In VB.NET, the number used in declaring the size of the array means the last index of the array.
So if I wanted 5 elements, I should declare it as:
Dim ia(4) As Int32
Ok, I guess my frustration has run its course…