小编Kho*_*son的帖子

Dictionary.ContainsKey甚至认为密钥存在时返回false

我有一段代码如下:

IDictionary<string, string> dictionary = new Dictionary<string, string>(){
        { "de-DE", "German"},
        { "en?GB", "English"},
        { "en?US", "English"},
        { "es?ES", "Spanish"},
        { "es?MX", "Spanish"},
        { "fr?CA", "French"},
        { "fr?FR", "French"},
        { "hu?HU", "Hungarian"},
        { "pl?PL", "Polish"},
        { "pt?PT", "Portuguese"},
        { "nl?NL", "Dutch"},
        { "nb?NO", "Norwegian"},
        { "sv?SE", "Swedish"},
        { "it?IT", "Italian"},
};
bool check = dictionary.ContainsKey("en-US");
Console.WriteLine(check);
Run Code Online (Sandbox Code Playgroud)

check回报false.有人可以帮忙解释一下吗?

c# dictionary

3
推荐指数
1
解决办法
315
查看次数

标签 统计

c# ×1

dictionary ×1