I was using Resharper 4 and noticed some nice code cleanup advise that it gives. One to note it the compression of:

// Create job if quote is won
if (CurrentQuote.Status == "A")
{
    quoteView.FindControl("btnCreateJobCard").Visible = true;
}
else
{
    quoteView.FindControl("btnCreateJobCard").Visible = false;
}

To the one liner (which I prefer)

// Create job if quote is won
quoteView.FindControl("btnCreateJobCard").Visible = CurrentQuote.Status == "A";

I like short succinct code. I think the shortened form is better, but I know some people need to do a double take to see what it’s trying to do.

I would love to hear your opinions on this.

Comment