Code I Found
- June 15, 2010 4:24 PM
- General
- Comments (4)
Its time for a new category here on my blog... I've been working through a good bit of older code at work and trying to update it to something like modern developer standards. Part of the fun of this has been finding weird, pointless language constructs. Check out this C# example:
EnableEditButtons(true);
else
EnableEditButtons(false);
Neat! This developer was able to use 4 lines of code to do one line of code:
Do you have any good examples of code that just shouldn't have been?
Update!
The EnableEditButton() function from the last example is worth a look too...
{
if (Value == false)
{
buttonAdd.Disabled = true;
buttonDelete.Disabled = true;
}
else
{
buttonAdd.Disabled = false;
buttonDelete.Disabled = false;
}
}
Could be wrapped up as:
{
buttonAdd.Disabled = buttonDelete.Disabled = !Value;
}