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

  • Thread starter Thread starter German Koninin
  • Start date Start date
G

German Koninin

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
 
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 said:
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.
 
Back
Top