Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / February 2005

Tip: Looking for answers? Try searching our database.

Good way to check for duplicate values in a SortedList?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim Bancroft - 28 Feb 2005 19:08 GMT
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
Cowboy (Gregory A. Beamer) - MVP - 28 Feb 2005 23:07 GMT
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!
***************************

> Hi everyone,
>
[quoted text clipped - 9 lines]
>
>     -Jim

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.