Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best .NET type for collections where each key can have multiple values?

Tags:

c#

I have one key but different values for that key. I tried HashTable but I don't think that is the right way of doing it.

I'll explain in detail what the requirement is:

I have a Key - "Asp.net" - for that I have n number of values - 61, 67, 100

So I have to store this somewhere like Dictionary or hash table.

like image 939
Srini Avatar asked Mar 19 '10 15:03

Srini


1 Answers

A Dictionary<string, List<int>> would do the trick for your sample data.

like image 78
Adam Robinson Avatar answered Sep 28 '22 18:09

Adam Robinson