Exceptions
blog on exceptions that i encounter daily.
Monday, November 8, 2010
Eliminate if else statements for disabling and enabling controls
if (count > 0)
{
this.control.Enabled = false;
}
else
{
this.control.Enabled = true;
}
// this is 1 line compared to what we have above.
this.control.Enabled = (count <= 0);
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment