加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-17 00:22:13 所属栏目:大数据 来源:网络整理
导读:我想做这个: 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中的文件:
我想做这个:
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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读