vb.net 的二维数组

2024-11-15 20:51:14
推荐回答(4个)
回答1:

Dim a(,) = {{1, 2}, {2, 5}}这样就行了

回答2:

dim a(7,11) as double
dim j,i as integer
for j=0 to 7
for i=0 to 11
a(j,i)=double(这是你要的值)
next i
next j
或者
dim a as double()=new double{(XXX,XXX),{XXX,XXX)......}'这是一次性赋值

回答3:

先纠正你一个错误,这里一共有8*12=96个数
至于写进去嘛,可以用array.copy或者array.ConstrainedCopy

回答4:

dim a(6, 10) as double
private sub 赋值
for zhsX as integer = 0 to 6
for zhsY as integer = 0 to 10
a(zhsX, zhsY) = zhsX + zhsY
next
next
end sub
这样每个元素都赋值为其行(X) + 列(Y)的值。