Add more values to the same key in dictionary(C#3.0)


I have a dictionary like

public Dictionary<DateTime, Dictionary<string, string>> dicCollection 

How can I add more values to the same key in this dictionary?

Using C# 3.0

Best Solution

If you want multiple values for a single key, you need to put the values into a collection or create an object which contains all the data members you need.

It might be easiest to just change your value to a List<>:

public Dictionary<DateTime, List<Dictionary<string, string>>> myDictionary;
Related Question