473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SortedList or Dictionary of KEYS ONLY

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
7 2233
"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
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
>
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
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
"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
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
Pamela,

Have a look at Arrays

Cor

Sep 28 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: none | last post by:
or is it just me? I am having a problem with using a dictionary as an attribute of a class. This happens in python 1.5.2 and 2.2.2 which I am accessing through pythonwin builds 150 and 148...
2
by: Zeng | last post by:
Would someone know why SortedList doesn't work for these two keys? System.Collections.SortedList.Add(Object key, Object value) +221 My code looks something like below, the...
1
by: gerrod | last post by:
Hi - Does anyone know a way to created a SortedList (in the System.Collections namespace) that will sort on VALUES instead of KEYS... ? The scenario is this - I have a SortedList containing...
2
by: Pekka | last post by:
Could somebody say why the piece of code below does not work? My purpose is to renumber keys in a SortedList (after removal of an item) so that the keys would always contain an unbroken sequence of...
14
by: vatamane | last post by:
This has been bothering me for a while. Just want to find out if it just me or perhaps others have thought of this too: Why shouldn't the keyset of a dictionary be represented as a set instead of a...
4
by: semedao | last post by:
Hi, I want to implement list of key-values that can be sort by 2 ways. let's say that in the first step I wanted to make SortList based on Key = int index that cannot change and Value is another...
1
by: raylopez99 | last post by:
I seem to get name collision between the Generic collection SortedList and C++.NET Framework collection SortedList. How to resolve? Here are the libraries that seem to clash:...
7
by: pamela fluente | last post by:
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...
1
by: Harold Howe | last post by:
Howdy all, The msdn help says this about SorteList<k,v>: "If the list is populated all at once from sorted data, SortedList is faster than SortedDictionary." My question is this: how do I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.