A simple C# code
bool result;
if (bool.TryParse("false", out result) && result)
{
Console.WriteLine(result);
}
and
bool result;
if (bool.TryParse("tRue", out result) && result)
{
Console.WriteLine(result);
}
Resharper says that result in Console.WriteLine(result) is always true. Why?
It’s due to the
&& resultpart – you’ll only ever get into the body of the statement ifresultis true. How do you anticipate any way of getting in there withresultbeingfalse?