After a incomprehensible bug, I found a strange behavior of &&
operator.
I extracted my code:
string s = "123";
Console.WriteLine(false && s.Length < 2 ? true : s.Substring(0,2).ToUpper() != "GA");
I expected the result is false
, but it gives me true
To receive the expected result, I put the second statement in ()
Console.WriteLine(false && (s.Length<2 ? true : s.Substring(0,2).ToUpper() != "GA"));
It gives me false
Code tested in fiddle
Someone has passed in same situation ?