我的语法有什么问题?我想通过info ["Gen"] ["name"]
获取值“Genesis”。
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"}
}}};
var
处是否遇到了编译错误..? - MethodManDictionary<string, string>
作为值呢?看起来你真正需要的是一个简单的Chapter
类。 - Jon Skeet