how to add duplicate keys to dictionary<string,string>

18,471

Solution 1

Check out this:

What is the point of Lookup<TKey, TElement>?

You can use the Lookup class to help you create collections with duplicates keys.

Solution 2

That doesn't make sense, if you added duplicate keys to the dictionary, how would it be able to find which one you want when you look them up?

Possibly you're looking for something like a List< KeyValuePair < T, T > >? Where you could store a list of pairs rather than an actual dictionary.

Share:
18,471
Innova
Author by

Innova

im very straight forward person

Updated on July 01, 2022

Comments

  • Innova
    Innova almost 2 years

    how to add duplicate keys to dictionary

    i.e i have already added the key,value pair as rollno,1 but i need to add the same parameter to the dictionary,but it is not allowing to add. how to add duplicated keys/repeated key in dictionary .

    or any other choice.. any idea???