Linked Questions
21 questions linked to/from Duplicate keys in .NET dictionaries?
32
votes
6
answers
70k
views
Is there Dictionary<Key,Value> without unique key? [duplicate]
Possible Duplicate:
Duplicate keys in .NET dictionaries?
I need to create a Collection<string,object>, one is a string and another one is an object.
I cannot use Dictionary since none of ...
1
vote
2
answers
136
views
generic class supports duplicated key [duplicate]
Possible Duplicate:
Duplicate keys in .NET dictionaries?
I want to use a kind of dictionary which can support duplicated keys. Is there any builtin support in .Net framework?
38
votes
5
answers
38k
views
What is an alternative to Dictionaries in C# that allows for duplicate keys?
I have a method that returns groups of technicians who have worked on certain projects, for example:
project 1 | John
project 1 | Tim
project 2 | John
project 2 | Dave
I originally tried to create a ...
30
votes
6
answers
103k
views
How to add duplicate keys into the Dictionary
I have some lines from text files that i want to add into the Dictionary.I am using Dictionary for the first time.While adding up starting lines it was Ok but suddenly i got error:
An item with the ...
23
votes
7
answers
27k
views
Is there an alternative to Dictionary/SortedList that allows duplicates? [duplicate]
Possible Duplicate:
C# Sortable collection which allows duplicate keys
Basically I'd like to make a Dictionary work with duplicate keys without going into custom comparer implementations. There is ...
12
votes
6
answers
20k
views
Does a sorted queue exist in .NET?
I have a need for a fairly specialised collection .NET, and I don't think that the BCL can help me, but I thought I'd throw it out there for if anyone knew of something similar.
Basically, my ...
8
votes
7
answers
22k
views
which c# collection to use instead of List<KeyValuePair<string, double>>?
I want to store data such as
{
{"apple",15 }
{"pear",12.5 }
{"", 10 }
{"", 0.45 }
}
Data will be plotted on a bar chart (string will be the ...
7
votes
3
answers
8k
views
C# collection indexed by property?
A problem I often run into is needing to store a collection of objects in such a way that I can retrieve them by a particular field/property that is a unique "index" for that object. For example, I ...
3
votes
1
answer
6k
views
Allow duplicate keys with ToDictionary() from LINQ query
I need the Key/Value stuff from a Dictionary. What I do not need is that it does not allow duplicate Keys.
Regex template = new Regex(@"\{(?<key>.+?)\}(?<value>[^{}]*)");
IDictionary<...
0
votes
1
answer
8k
views
Create list of keys with multiple values within in single key and duplicate entry of the keys
I am new to vb.net. I want to create a key value pair or an array which ever is possible from a dynamic loop. The key name can have multiple entries I want output in following manner. I tried with ...
1
vote
2
answers
3k
views
Alternate for a dictionary allowing duplicates
I need an alternate for a dictionary, because duplicates are needed. The reason for that is:
I need to search for the best route. To do that I am creating a population with 20 individuals for example....
1
vote
1
answer
3k
views
Creating json object with duplicate keys in C#
I am creating a json string by serializing an object in C# (using Newtonsoft) to pass to a third party charting library, so have no control over the structure I need to create. The structure requires ...
-5
votes
2
answers
1k
views
I want to create a json file with same key and different value using dictionary in c#
Here is the sample i need to form. I tried hash set it is showing as key and value but i need my output to be in the below format.
[{
"data": "Name"
},
{
"data": "Description"
}]
My sample ...
0
votes
2
answers
1k
views
C# Multiple Keys with Multiple Values in Dictionary and postprocess the Dictonary [closed]
I have a csv file with repetitive keys and multiple values from a csv. I have successfully parsed every row of csv in C#
My csv file looks like this
eid,hr
ABC,25
ABC,35
FDG,50
LMN,61
Task1
I would ...
-4
votes
1
answer
816
views
Is it possible to have duplicate key with different values in Dictionary in C#?
I have Dictionary like this below.
The key is names like cups, pens, tape, glasses, and rocks. The values will be classes that contain things such as amount, types, images, etc.
The value is from the ...