Adding to a Dictionary within a dictionary

I would probably simplify this by having one dictionary and joining the keys thus "simulating" a grouping.

 string key = userAgentResult + allowDisallowKey;

 static Dictionary<string, List<string> testDictionary = ...

 testDictionary[key] = list;

You simply need to manage one dictionary.


In this case what you need to do is not adding an entry to the inner dictionary. You need to add the value to the key-value pair of the outer dictionary. Only this time the value happens to be yet another dictionary :)

testDictionary[userAgentResult] = allowDisallowDictionary;