Wednesday, April 28, 2010

throw new DumbCodingException

I came across the dumbest code I've seen in a while at work today.

try
{
    return _Collection.Length;
}
catch (NullReferenceException)
{
    return 0;
}


I found it because when debugging an asp.net page, I had enabled thrown exception breaks and this code was causing about 5 debug breaks for every page load...  Needless to say it has now been rewritten.


No comments:

Post a Comment