我的語法有什麼問題?我希望能夠用這個info["Gen"]["name"]
C#嵌套字典
public var info = new Dictionary<string, Dictionary<string, string>> {
{"Gen", new Dictionary<string, string> {
{"name", "Genesis"},
{"chapters", "50"},
{"before", ""},
{"after", "Exod"}
}},
{"Exod", new Dictionary<string, string> {
{"name", "Exodus"},
{"chapters", "40"},
{"before", "Gen"},
{"after", "Lev"}
}}};
你會得到什麼編譯器錯誤? – 2013-03-19 13:44:36
你在'var'這個詞上得到了一個編譯錯誤..? – MethodMan 2013-03-19 13:45:13
除了錯誤的實際原因之外,當你真的想要一個簡單的'Chapter'類時,爲什麼你會使用'Dictionary'作爲值呢? –
2013-03-19 13:46:46