I'm just looking for any example that this two methods produces different results. First of all, I visit msdn page, and run code from it with minor changes
using System;
using System.Globalization;
using System.Linq;
class Program
{
static void Main()
{
string[] words = { "Tuesday", "Salı", "Вторник", "Mardi",
"Τρίτη", "Martes", "יום שלישי",
"الثلاثاء", "วันอังคาร" };
Console.BufferHeight = 1000;
var test = CultureInfo.GetCultures(CultureTypes.AllCultures)
.Select(ci =>
{
string[] wordsToLower = words.Select(x => x.ToLower(ci)).ToArray();
string[] wordsToLowerInvariant = words.Select(x => x.ToLowerInvariant()).ToArray();
return new
{
Culture = ci,
ToLowerDiffers = !wordsToLower.SequenceEqual(wordsToLowerInvariant)
};
})
.ToArray();
foreach (var x in test)
{
Console.WriteLine("Culture {0}, ToLower and ToLowerInvariant produces different results: {1}", x.Culture, x.ToLowerDiffers);
}
Console.WriteLine();
Console.WriteLine("Difference exists for any ToLower call: {0}", test.Any(x => x.ToLowerDiffers));
}
}
But here I have a problem: this code produces the same output for ToLower
and ToLowerInvariant
calls in all existing cultures.
So question is: there is any string that produces different results for this test?
Try the Turkish dotted
İ
: