According To MSDN : StringComparison.InvariantCulture
:
Specifies the culture, case, and sort rules to be used by certain overloads of the String.Compare and String.Equals methods.
Well , I'm not doing any sort here in my sample , And still don't understand why does it yield the result it yield :
/*1*/ void Main()
/*2*/ {
/*3*/ string s1 = "lasst";
/*4*/ string s2 = "laßt";
/*5*/ Console.WriteLine (s1.Equals(s2, StringComparison.InvariantCulture));
/*6*/ //True
/*7*/
/*8*/
/*9*/
/*10*/ string s3 = "hello";
/*11*/ string s4 = "héllo";
/*12*/ Console.WriteLine (s3.Equals(s4, StringComparison.InvariantCulture));
/*13*/ //False
/*14*/ }
InvariantCulture
uses comparison rules based on english, but without any regional variations
1) So why it says that lasst
is equal to laßt
? (one doesnt even has an english char...)
2) And why ( if it's flatten to english)hello
is not equal to héllo
?