Monday, 15 February 2010

How to I declare and initialize a multidimensional array in VB.NET? -



How to I declare and initialize a multidimensional array in VB.NET? -

i want this:

dim numbers integer()() = {{1}, {2}, {3}, {4, 5, 6, 7}}

the ide's underlining 4, 5, 6, 7 , saying array initializer has 3 many elements. doing wrong?

the next should work:

dim numbers integer()() = {({1}), ({2}), ({3}), ({4, 5, 6, 7})}

as documents in arrays in visual basic:

you can avoid error when supply nested array literals of different dimensions enclosing inner array literals in parentheses. parentheses forcefulness array literal look evaluated, , resulting values used outer array literal

vb.net multidimensional-array

No comments:

Post a Comment