add a list into another list in vb.net

前端 未结 3 1560
伪装坚强ぢ
伪装坚强ぢ 2020-12-17 19:54

I have a list as follows and I want to add it in another list:

Dim listRecord As New List(Of String)
listRecord.Add(txtRating.Text)
listRecord.Add(txtAge.Tex         


        
3条回答
  •  爱一瞬间的悲伤
    2020-12-17 20:29

    I assume from your question you want nested Lists, not to simply append one list onto the end of another?

    Dim listRecord As New List(Of String)
    listRecord.Add(txtRating.Text)
    listRecord.Add(txtAge.Text)
    listRace.Add(listRecord)
    
    Dim records as new List(of List(of String))
    records.Add(listRecord)
    

    Hope this helps

    Update
    Reading them is like accessing any other list.
    To get the first field in the first record

    return records(0)(0)
    

    second field in first record

    return records(0)(1)
    

    etc . . .

提交回复
热议问题