vb.net fastest way to remove duplicates from listview? -
does have quicker , better way remove duplicates listview? doing this: sort items alphabetically, , checks item below , compares 1 above.
this time consuming though.. when enter 20.000 records excel sheet, , remove duplicates takes few miliseconds, code below takes hours check 20.000 items in vb.net. know of faster method?
dim max integer = listview2.items.count dim integer = 0 each item listviewitem in listview2.items if = max exit end if if > 0 if item.text = listview2.items(i - 1).text max -= 1 item.remove() -= 1 end if end if += 1 label4.text = "total domains: " & listview2.items.count next
use hashset
accept unique values.
dim itemstext = listview2.items.cast(of listviewitem).select(function(item) item.text) dim uniquesvalues hashset(of string) = new hashset(of string)(itemstext)
then set items hashset
listview
.
Comments
Post a Comment