473,378 Members | 1,413 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,378 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 1559
"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...
3
by: studen77 | last post by:
I'm not comprehending how C# assigns indexes to items you add to a SortedList item. Here's some example code: sl.Add ("first_item","First Item"); sl.Add ("second_item", "Second Item"); sl.Add...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.