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 && result
part - you'll only ever get into the body of the statement if result
is true. How do you anticipate any way of getting in there with result
being false
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With