I would like some clarification on the following IF statement. I know this sort of statement can be written in many different ways... that's not what i'm asking. I am really curious why ReSharper 7 is telling me that comparing canceled == true
is redundant.
bool canceled;
if (Boolean.TryParse(Request.QueryString["cancel"], out canceled) &&
canceled == true)
{
// Transaction canceled...
}
It's my understanding that Boolean.TryParse()
will return true/false based on the success of the conversion, not the actual result of the out parameter. Why then would comparing canceled == true
be redundant? It very well could be false at that point, right?