Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 多层C语言词典#_C#_Dictionary - Fatal编程技术网

C# 多层C语言词典#

C# 多层C语言词典#,c#,dictionary,C#,Dictionary,各位!!在我解释之前,我必须说,我在这里试图阅读一些与我的案例类似的问题,但无法找到如何解决我的问题,这就是我在这里提问的原因 简单地说,我正在开发一种关于Pokémon的数据库(这样谁知道Pokémon能理解我在做什么),我正在用json导入一个包含我需要的数据的txt文件。到目前为止,我使用双字符串字典结构(字典字符串,字符串)来处理所有数据,如 "2"(this is a value used to handle the list of all Pokémon, in fact 2 is

各位!!在我解释之前,我必须说,我在这里试图阅读一些与我的案例类似的问题,但无法找到如何解决我的问题,这就是我在这里提问的原因

简单地说,我正在开发一种关于Pokémon的数据库(这样谁知道Pokémon能理解我在做什么),我正在用json导入一个包含我需要的数据的txt文件。到目前为止,我使用双字符串字典结构(字典字符串,字符串)来处理所有数据,如

"2"(this is a value used to handle the list of all Pokémon, in fact 2 is for ivysaur): {
    "number": 2,
    "national": "2",
    "where_to_find": {
        "red": "-",
        "blue": "-",
        "yellow": "-",
        (and so on until shield, it's just a list of locations in every game where to find the pkmn)
    }
还有更多这样的数据结构,就像上面所看到的“where\u to\u find”这样的单字符串键或字典(双字符串)。 在代码开始时,我创建了一个类来处理列表中每个索引(每个pkmn)的键,并清楚地说明了这一点

        public Dictionary<String, String> where_to_find;
        public String number;
        public String national;
上面还说,

        public Dictionary<String, Dictionary<String, String>> hello;
在这种情况下,messagebox应该写上“问候语”。我不能做的是这种公式,比如口袋妖怪。你好。嗨。嗨,或者口袋妖怪。你好[“嗨”[“嗨”]]。我该怎么做?提前感谢您的建议和回答。

试试
hello[“hey”][“hi”]


您正在“hey”字符串上使用第二个索引([“hi”]),这需要一个Int索引,您应该在我尝试过的

之外使用它,但是当我选择[“hey”[它建议我应该插入一个Int索引。您应该在“hey”字符串上使用第二个索引([“hi”]),即expect和Int索引,您应该在hello[“hey”]之外使用它返回您的字典,其中hi-key是store。哦,我读错了,现在我明白了。我按照您所说的做了尝试,用两个分开的[][],效果很好!非常感谢!
        public Dictionary<String, Dictionary<String, String>> hello;
   Messagebox.Show(pokemon.hello.hey.hi);