tags:

views:

602

answers:

3

I have a data like in (string , int) pair. How to store this data in collection object. Both values can be duplicate. Which collection object should i use??

EDIT: How can i access elements separately..??

+4  A: 

You can use List<KeyValuePair<string,int>>.

This will store a list of KeyValuePair's that can be duplicate.

Oded
+3  A: 

You can use List<KeyValuePair<string, int>> if you want to add & remove items, or KeyValuePair<string, int>[] if the number of items is known

thecoop
+2  A: 

If you want to avoid repeating the key for multiple values you can use Dictionary<string, List<int>>.

Brian Rasmussen