vb.net - multi-dimension array list

前端 未结 2 1324
死守一世寂寞
死守一世寂寞 2021-02-06 13:46

I\'ve managed to make some single dimension array lists but I can\'t figure out a multi dimension arraylist.

Here\'s what I\'m trying to do:

I have a database (m

2条回答
  •  逝去的感伤
    2021-02-06 14:05

    ' This allows adding rows on the fly....Tested and it works!

    Dim multiList As New List(Of List(Of String))
    Dim ListRow As Integer = 0
    
    For each record in some_source 
      dim Country as string = record.country 'from some source 
      dim Date as Date = record.Date 'from some source 
      dim Venue as string = record.Venue 'from some source 
      dim Attendance as string = record.Attendance 'from some source 
    
      multiList.Add(New List(Of String))
      multiList(ListRow).Add(Country)
      multiList(ListRow).Add(Date)
      multiList(ListRow).Add(Venue)
      multiList(ListRow).Add(Rating)
      multiList(ListRow).Add(Attendance)
      ListRow = ListRow + 1
    next
    

提交回复
热议问题