Hmm interesting question. If you look at ILSpy , you will see decompiled code as:
string str = "abc";
string a;
if ((a = str) != null && a == "")
{
Console.WriteLine("Hello");
}
Console.ReadLine();
The reason it is converted to a block if-elseis because if the switch statement contains 5or is less than the 5case clause , then it will be treated like if - elsethat, otherwise the lookup table will be used. I'm not sure about the quantity 5, but this is what is shown in ILSpy)
a == "", , :
CA1820:
String.Length String.IsNullOrEmpty , . , Equals MSIL , IsNullOrEmpty Length . , Equals Length == 0 - . Length null, System.NullReferenceException. , ; false. null . .NET Framework 2.0 IsNullOrEmpty . Length ==, .