473,395 Members | 1,869 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,395 software developers and data experts.

Any kind of sorted container(collection) where key is not unique?

Hi guys.
I'm quite new in C# migrating from C++. I'm looking for a good associate
container where keys will be not unique. Just like in STL multimap or
miltiset. Unfortunately I found only SortedDictionary and SortedList which
is quite rookie stuff, so there is no options to keep non unique keys...

Thanks
German Koninin

Feb 2 '06 #1
1 2669
Yes, that's what I'm using now.
This is quite ugly way compared with STL multimap and iterators in VC++

Anyway thanks for your answer.
"Vadym Stetsyak" <va*****@ukr.net> wrote in message
news:uV***************@TK2MSFTNGP12.phx.gbl...
You can simulata the behavior you need.
As I understand you have the situation, where you have the same key & multiple (different ) values, right?
Then you can use SortedDictionary in the following way
Suppose your key is of type int and values are strings, then

SortedDictionary<int, List<string>> dict; // if the number values for each key is small SortedDictionary<int, SortedDictionary<int, string>> dict; // if the number of values is lage and you need fast value search.
--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"German Koninin" <germanD0Tkoninin/_\TcolumbuscrmD0|com> wrote in message

news:ey**************@TK2MSFTNGP10.phx.gbl...
Hi guys.
I'm quite new in C# migrating from C++. I'm looking for a good associate
container where keys will be not unique. Just like in STL multimap or
miltiset. Unfortunately I found only SortedDictionary and SortedList which is quite rookie stuff, so there is no options to keep non unique keys...

Thanks
German Koninin

Feb 2 '06 #2

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

Similar topics

19
by: Nafai | last post by:
Hi I want to write a function which erases al the repeated elements in a range. How should be the prototype? template <class Iterator> void eraseRepeated(Iterator begin, Iterator end); ...
11
by: Pavils Jurjans | last post by:
Hello, There's some confusion about the purpose and difference between these handy classes... First, both of them are holding number of key - value pairs, right? Then, I see that there may be...
2
by: howard | last post by:
If you have a sorted collection, how do you find the location ^closest^ to where a particular key would be if an element with key isn't in the collection? For example, if you have a SortedArray...
5
by: faustino Dina | last post by:
Hi, I need to store my data on a sorted collection, where the sorting key can be duplicated. I've been looking around .NET collection classes but they expects unique keys for sorting. What can I...
0
by: Jeff Haumesser | last post by:
Hi ! I've looked at the MS Article "Sorting the Unsortable Collection" in msdn and it works great. It is a class called a SortedView that is a wrapper for my collection, allowing sorting...
9
by: Michael D. Ober | last post by:
In the code below, the IComparator function is never called. What am I missing? Public Class ArchiveInfo Implements System.IComparable(Of ArchiveInfo) Public FullName As String = "" Public...
6
by: Burt | last post by:
I need to create a collection of classes (or structures) can be accessed by a string key, eg MyColl("ShortName5").Name for class with key ShortName5. But it also has to be sorted by a second...
18
by: Hunk | last post by:
Would like some advice on the fillowing I have a sorted list of items on which i require to search and retrieve the said item and also modify an item based on its identity. I think an Map stl...
3
by: jacob navia | last post by:
Abstract: Continuing the discussion about abstract data types, in this discussion group, a string collection data type is presented, patterned after the collection in C# and similar languages...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.