Dictionary> myDict = new Dictionary >(); myDict.Add("Alice", new Dictionary ()); myDict["Alice"].Add("age", 25); myDict["Alice"].Add("height", 170); // Add a new column to "Alice" myDict["Alice"].Add("weight", 60);
DictionaryIn this example, we create a dictionary 'myDict' that contains integers as keys and lists of strings as values. We then add two keys to the dictionary with their respective lists. Finally, we use the Key AddColumn method to add a new string "D" to the list with key 1.> myDict = new Dictionary >(); myDict.Add(1, new List {"A", "B", "C"}); myDict.Add(2, new List {"D", "E", "F"}); // Add a new column to key 1 myDict[1].Add("D");