how to make a deep copy of my list

后端 未结 2 1566
我寻月下人不归
我寻月下人不归 2020-12-21 11:46
 Dim i = 2
    Do While True
        i += 1
        If IsDBNull(TmDataSet.T.Rows(0)(i)) = True Then Exit Do
        Dim new_t As New train
        new_t.id = TmDataS         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-21 12:01

    This is the code I used

    Dim deepCopies = _dictOfBalances1.Keys.ToList
    

    Basically deepCopies is a deep copy of _dictOfBalances1.Keys

    This code won't work if deepCopies are shallow copies.

    For Each code In deepCopies
        If allthecoincode.Contains(code) Then
        Else
            _dictOfBalances1.Remove(code)
            'deletedKeys.Add(code)
        End If
    Next
    

提交回复
热议问题