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 / June 2006

Tip: Looking for answers? Try searching our database.

OrderedDictionary - to retrieve objects in same order

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Suhaib - 28 Jun 2006 16:20 GMT
Hi,
  I want to use OrderedDictionary to get my objects in same order as they
are inserted in. I also want to access the objects using a key. So my
question is whether this is the best option or there is some better
collection object than OD. The current MSDN documentation dosn't says
anything in favor or against OD for retrieving object in order.

Remember I don't want ot sort objects on keys or anything else.

Thanks in advance,
Suhaib
Kevin Spencer - 28 Jun 2006 17:18 GMT
Good question. The documentation for this class is very cryptic about how it
is "ordered." I can't tell for sure whether it is ordered internally (which
I doubt) or simply by the enumerator. The examples are bad in that when they
demonstrate getting the values in the OrderedDictionary by Keys, they use a
list that has been entered in non-alphabetical order, but when they
demonstrate getting the values using an enumerator, they enter the list
items in alphabetical order, thus muddying the waters as to why the items
came back *out* in alphabetical order. The text is not clear about this.

However, some experiments should answer the questions for you. I would
imagine that the items are added to the list in the order in which they were
actually added, and that when you get the keys by copying, the order is not
changed, which would satisfy your requirements. I would also guess (with
less confidence) that using an enumerator sorts the items. But again, it
shouldn't be hard to set up a test for this.

Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.

> Hi,
>   I want to use OrderedDictionary to get my objects in same order as they
[quoted text clipped - 7 lines]
> Thanks in advance,
> Suhaib
William Sullivan - 29 Jun 2006 16:34 GMT
Check out the Power Collections library at www.wintellect.com.  Lots of
generic goodness there...

> Hi,
>    I want to use OrderedDictionary to get my objects in same order as they
[quoted text clipped - 7 lines]
> Thanks in advance,
> Suhaib

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.