I have my dictionary declared as follows:
private static Dictionary<string, Dictionary<string, string>> myDictionary;
I want to initialize it globally. The closest I arrived initializes the external dictionary, but still leaves me with a null reference to the internal dictionary:
private static Dictionary<string, Dictionary<string, string>> myDictionary
= new Dictionary<string, Dictionary<string, string>>();
I need not to initialize it in the method, because I do not want to force the user to call the method before using my class. The user has access only to static methods. I could create a singleton when they call one of the methods, but this one is dirty.
How can I declare both dictionaries globally? Something along the lines of one of them (although not compiled):
private static Dictionary<string, Dictionary<string, string>> myDictionary
= new Dictionary<string, new Dictionary<string, string>>();
or
private static Dictionary<string, string> inner = new Dictionary<string, string>();
private static Dictionary<string, Dictionary<string, string>> myDictionary
= new Dictionary<string, inner>();