我正在将一些独特的法语单词添加到排序列表中,但它似乎无法区分某些单词,例如“b\xc5\x93uf”和 boeuf”。
\n\nprivate static void TestSortedList()\n{\n\n Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-fr");\n SortedList sortedList = new SortedList(new Comparer(CultureInfo.CurrentCulture));\n\n try\n {\n sortedList.Add("b\xc5\x93uf", "Value1");\n sortedList.Add("boeuf", "Value1");\n }\n catch(Exception ex)\n {\n Console.WriteLine(ex.ToString());\n }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n因此上面的以下代码会抛出异常“System.ArgumentException:项目已被添加。”\n请帮忙!
\n