May 2010
Intermediate to advanced
1272 pages
61h 18m
English
Array literals also affect multidimensional and jagged arrays. The following line of code shows how you can declare a multidimensional array of integers taking advantage of array literals:
Dim multiIntArray = {{4, 3}, {2, 1}}
In this case you do not need to add parentheses. The Visual Basic compiler infers the type as follows:
Dim multiIntArray(,) As Integer = {{4, 3}, {2, 1}}
Figure 21.3 shows how you can check the inferred type by passing the mouse pointer over the declaration, getting a descriptive tooltip.
Figure 21.3 Type inference for a multidimensional array.

Array literals work similarly on a jagged array. ...
Read now
Unlock full access