如何在VB.NET中声明和初始化多维数组?

前端之家收集整理的这篇文章主要介绍了如何在VB.NET中声明和初始化多维数组?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想做这个:
Dim Numbers As Integer()() = {{1},{2},{3},{4,5,6,7}}

IDE强调4,7并且说Array初始化器有3个太多的元素.我究竟做错了什么?

以下应该有效:
Dim Numbers As Integer()() = {({1}),({2}),({3}),({4,7})}

作为Arrays in Visual Basic中的文件

You can avoid an error when you supply nested array literals of different dimensions by enclosing the inner array literals in parentheses. The parentheses force the array literal expression to be evaluated,and the resulting values are used with the outer array literal

猜你在找的VB相关文章