我想dinamycally设置第二个数组维度取决于for循环中的第一个维度。我现在无法为此找到任何文档。如果有人拥有它,我不介意被提到正确的地方。在一个循环中设置一个数组的第二维
Dim array(3,0) As String
For y As Integer = 0 To array.GetUpperBound(0) - 1
<<Set here the second dimension of the array to another dynamic variable
(Something Like array(y).dimensionsize = X. Where y is my first dimension argument)>>
For i As Integer = 0 To array.GetUpperBound(1) - 1
array(y, i) = "something"
Next
Next
这可能吗?
编辑:
的情况是,我从AD组成员身份。用户通常有多个帐户。
第一个循环遍历帐户数量,第二个循环遍历每个帐户中的广告组。
UserResult是AD查询结果
这是在开始时的声明,因为它经过一个BackgroundWorker。我需要它是全球性的:
Public Shared UserInfoGroup(1)() As String
我很感兴趣,我backgroundworker.dowork内的部分:
ReDim UserInfoGroup(UserResult.Count)(1)
For y As Integer = 0 To UserResult.Count - 1
Dim UserGroupArray As PrincipalSearchResult(Of Principal) = UserResult(y).GetGroups()
ReDim UserInfoGroup(UserResult.Count)(UserGroupArray.Count)
For i As Integer = 0 To UserGroupArray.Count - 1
UserInfoGroup(y)(i) = UserGroupArray(i).ToString()
Next
Next
的backgroundworker.completed然后输出数组的形式。
你想让它成为一个锯齿状的数组(每列的列数不同)吗? –