Declaring Arrays - Syntax

  • Thread starter Thread starter DesCF
  • Start date Start date
D

DesCF

What is the difference between declaring an array like this:


Dim DataTables As DataTable()


and like this:


Dim DataTables() As DataTable


Both seem to work, i.e.


Dim DataTables As DataTable() = New DataTable() {New DataTable("Orders"),
New DataTable("Customers")}
Dim DataTables() As DataTable = New DataTable() {New DataTable("Orders"),
New DataTable("Customers")}




Des
 
DesCF said:
What is the difference between declaring an array like this:

Dim DataTables As DataTable()

and like this:

Dim DataTables() As DataTable

They are semantically equivalent, It's up to your personal preference to
choose one over the other.

Personally I prefer the latter version because 'Dim DataTables As
DataTable()' could be more easily misread as 'Dim DataTables As New
DataTable()' by the reader.
 
Back
Top