I have the following C# code in my ASP.NET MVC application. I try to compare 2 string using the Equals method, with culture = "vi". My code below:
string culture = "vi";
System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
System.Threading.Thread.CurrentThread.CurrentUICulture =
System.Threading.Thread.CurrentThread.CurrentCulture;
var CCC = string.Equals("CategId", "CATEGID", StringComparison.CurrentCultureIgnoreCase);
var xx = string.Equals("TestGID", "TestGID", StringComparison.CurrentCultureIgnoreCase);
var zz = string.Equals("id", "ID", StringComparison.CurrentCultureIgnoreCase);
Results:
CCC = false;
xx = true;
zz = true;
I don't know why CCC is false. Is there anything wrong? If I set culture = id, ko, en, etc... then CCC = true. Who can help me?