辞書オブジェクトを作成しました
Dictionary<string, List<string>> dictionary =
new Dictionary<string,List<string>>();
特定の単一キーの文字列のリストに文字列値を追加したいと思います。キーがまだ存在しない場合は、新しいキーを追加する必要があります。List<string>
は事前定義されていません。つまり、リストオブジェクトを作成してから、に提供していませんdictionary.Add("key",Listname)
。このリストオブジェクトを動的に作成し、dictionary.Add("key",Listname)
このリストに文字列を追加する方法。100個のキーを追加する必要がある場合、命令を実行する前に100個のリストを作成する必要がdictionary.Add
ありますか?また、このリストの内容をペデファインする必要がありますか?
ありがとうございました。