By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,028 Members | 1,108 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,028 IT Pros & Developers. It's quick & easy.

Fast always automatic sorted list, in C#?

P: n/a
I have to load about 10000 possible file names into a list and must have
thems sorted alphabetically, including the file information.
At this moment, in conventional C++, I use a sorted file strng list with a
binary search to add the file name at the correct location, this way it is
very fast. I but I created my own string list.

So here is my question: Does C# or the .NET framework have such a sorted
list that I can add the items during the load phase at the correct position
so that it is always automatically sorted? I don't want to reinvent the
wheel.

Thanks. :-)

--
http://www.skyscan.be

Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I'd used HashTables. Items are indexed by the values they contain. Very
quick indeed.

http://msdn.microsoft.com/library/en...ClassTopic.asp
[beware line wraps]

"Olaf Baeyens" <ol**********@skyscan.be> wrote in message
news:41*********************@news.skynet.be...
I have to load about 10000 possible file names into a list and must have
thems sorted alphabetically, including the file information.
At this moment, in conventional C++, I use a sorted file strng list with a
binary search to add the file name at the correct location, this way it is
very fast. I but I created my own string list.

So here is my question: Does C# or the .NET framework have such a sorted
list that I can add the items during the load phase at the correct
position
so that it is always automatically sorted? I don't want to reinvent the
wheel.

Thanks. :-)

--
http://www.skyscan.be

Nov 16 '05 #2

P: n/a
> I'd used HashTables. Items are indexed by the values they contain. Very
quick indeed.

http://msdn.microsoft.com/library/en...ClassTopic.asp

Wow, a super fast reply. :-)
I am checking into this, it seems interesting, but I must have it in sorted
order because I have sequence numbers in the file names, and I must be able
to determin if some of them are missing without having to try all possible
combinations.

It is a sequence of bitmaps representing a data-set or maybe a movie. So the
order of putting the images together is important.

Thanks for the tip! :-)

--
http://www.skyscan.be
Nov 16 '05 #3

P: n/a
I believe that this: "System.Collections.SortedList" might do the trick. :-)
Nice!!!

--
http://www.skyscan.be
Nov 16 '05 #4

P: n/a
In light of the info you provided, SortedList is the way to go, but beware
the length limits on key string fields. I was having problems yesterday with
this actually, and had to change to a StringDictionary (whihc probably
wouldn't suit your needs).

Later.
Dan

"Olaf Baeyens" <ol**********@skyscan.be> wrote in message
news:41*********************@news.skynet.be...
I believe that this: "System.Collections.SortedList" might do the trick.
:-)
Nice!!!

--
http://www.skyscan.be

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.