Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is the difference between the two statements

Status
Not open for further replies.

leangross

IS-IT--Management
Jul 3, 2002
84
PH
Dim buff(1001) As Char
Dim buff2 As Char()
 
To declare an array in VB.NET, it is easy:

Code:
Dim arrayOfIntegers(10) As Integer

One feature of arrays in VB.NET is that there's another way to declare an array. You see, for backward compatibility, Microsoft kept the old VB6 syntax for declarations. However, this will work as well:

Code:
Dim arrayOfIntegers As Integer()

This method will seem more intuitive to programmers with a C background. Some developers prefer the latter because to them, an Integer isn't the same as an Integer() so this is more clear to them. Moreoever, it's consistent with C style, so they don't have to rethink what they are doing when they are flipping between C# and VB.NET. The only downside is that you can't declare and instantiate the array in one line.

You can find some interesting info about arrays in VB.NET from:
1. 2.
Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top