Good way to check for duplicate values in a SortedList?

  • Thread starter Thread starter Jim Bancroft
  • Start date Start date
J

Jim Bancroft

Hi everyone,

I know you can't insert duplicate keys in a SortedList, but there's no
law against duplicate _values_, and I was wondering if anyone knows of a
good way to check if value XYZ is in more than one slot? I know I can loop
through the list and check every value against all the others, but I wasn't
sure if this was the only way to go about it. SortedList does have an
"IndexOfValue" method, but it only returns the first matching value, not a
list of values or a count of how many match.

Thanks for your advice,

-Jim
 
If you are attempting to sort out dupes, consider creating a hashtable to go
along side the Sorted list. Pull a list of values by index and insert into
hashtable. If the hashtable already contains that key, delete the item in the
sorted list.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top