SortedList sortedList = new SortedList(StringComparer.Ordinal);
try
{
sortedList.Add("bœuf", "Value1");
sortedList.Add("boeuf", "Value1");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
works. To explain, the Ordinal
and OrdinalIgnoreCase
comparers compare the characters bytes and they are different for different chars.
See Difference between InvariantCulture and Ordinal string comparison too.