vb.net remove from 2d list based on 3 subitems
I have two list of list of object's, based on three subitems of list1 if those subitems exists on an item of list2 then remove that from list2. I keep finding rows from list2 that exist in list1 and i am out of ideas.
Code:
Dim list1 As New List(Of List(Of Object))
Dim list2 As New List(Of List(Of Object))
Dim it As Integer = Nothing : Dim it2 As Integer = Nothing
While it < List1.count
While it2 < list2.Count
If list1(it).Item(0).ToString = list2(it2).Item(0).ToString And list1(it).Item(3).ToString = list2(it2).Item(3).ToString And list1(it).Item(6).ToString = list2(it2).Item(6).ToString Then
list2.RemoveAt(it2)
End If
it2 += 1
End While
it += 1 : it2 = 0
End While
Re: vb.net remove from 2d list based on 3 subitems
What's in those inner lists? From the way you're using them, it looks like they should be classes with properties rather than lists with items. Can you please provide a FULL and CLEAR description of the data and what it represents?
Re: vb.net remove from 2d list based on 3 subitems
Quote:
What's in those inner lists?
If the code is anything to go by ... nothing! They are never given any items. The whole procedure's baffling anyway. If a list in List1 contains items at 0,3, and 6 which are identical to the items in a list in List2 at those positions then delete the list from List 2? Also this is bound to run itself into the ground as it's committing the cardinal sin of counting forward in iterating a list from which items may be removed.