【发布时间】:2010-03-22 10:31:05
【问题描述】:
这个 C#/WPF 代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace TestDict28342343
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
Dictionary<string, string> variableNamesAndValues =
new Dictionary<string, string>(StringComparison.InvariantCultureIgnoreCase);
}
}
}
给我错误:
最好的重载方法匹配 'System.Collections.Generic.Dictionary.Dictionary(System.Collections.Generic.IDictionary)' 有一些无效的参数
但我发现这个代码示例无处不在,例如 here 和 here。
如何定义不区分大小写键的字典?
【问题讨论】:
标签: c# dictionary case-insensitive