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

SortedList or Dictionary of KEYS ONLY

P: n/a
I noticed that I am using quite often SortedLists where I use KEYS
only.

when I add new elements I use something like : MyKeyObj ,
Nothing/Null/false

Is there a collection type which is similar to the SortedList by does
NOT
have the Values ?

And, a similar question, I have for the Dictionary.
-P

Sep 28 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
"pamela fluente" <pa***********@libero.itschrieb
I noticed that I am using quite often SortedLists where I use KEYS
only.

when I add new elements I use something like : MyKeyObj ,
Nothing/Null/false

Is there a collection type which is similar to the SortedList by
does NOT
have the Values ?

And, a similar question, I have for the Dictionary.
Did you know that there are .Net Framework groups for language independent
questions? You can find them here: m.p.dotnet.framework[.*]
Armin

Sep 28 '07 #2

P: n/a
On 28 Set, 13:53, Samuel R. Neff <samueln...@nomail.comwrote:
We use a custom collection called KeySet<Tfor a dictionary of keys
only since this scenario comes up a lot. It's made programming these
things a lot easier to read and maintain.

Watch the line wrapping...

HTH,

Sam
Thanks Sam,

It's very generous of you to provide your code.

I was also thinking to do the same (actually more simple :-). By
inheriting from
a SortedList of Key, Boolean or a Dictionary of Key, Boolean and
"shielding"
the Values.

But I guess that would not be much different from using the standard
classes and adding Null Values.

It's strange Microsoft dose not seem to provide them (does it?).
Since one has custom comparers in .NET
its quite natural that the Key can hold all the necessary
information. No?

-P

Sep 28 '07 #3

P: n/a
>
Did you know that there are .Net Framework groups for language independent
questions? You can find them here: m.p.dotnet.framework[.*]
you do not want me here !? :-))
Cheers,

-P

PS
Thanks, actually I did not know that!
>
Armin

Sep 28 '07 #4

P: n/a
You might want to look into one of the free collection libraries, e.g. "C5"
or "Power Collections" - these have lots of diffrent Set implementations.
Sep 28 '07 #5

P: n/a
"pamela fluente" <pa***********@libero.itschrieb
>

Did you know that there are .Net Framework groups for language
independent questions? You can find them here:
m.p.dotnet.framework[.*]

you do not want me here !? :-))
I didn't say this. You're always welcome! Just makes sense to use the groups
for which they are made for. :-)
Armin

Sep 28 '07 #6

P: n/a
On 28 Set, 16:07, Niels Ull <niels...@hotmail.comwrote:
You might want to look into one of the free collection libraries, e.g. "C5"
or "Power Collections" - these have lots of diffrent Set implementations.
I have just looked at Power Collections. I did not know they existed.

Thanks,

-P
Sep 28 '07 #7

P: n/a
Pamela,

Have a look at Arrays

Cor

Sep 28 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.