Extension Method Abomination

For some reason this code came to mind today, and I shuddered a bit:

public static class ObjectExtensions
{
    public static bool IsNull(this object obj)
    {
        return obj == null;
    }
}

Because now you can write code like this:

object o = null;
Assert.IsTrue(o.IsNull());

All I can do is look at the code and stare in wonder...

(BTW I didn't compile this, but I think this should work!)

* Posted at 10.11.2007 02:47:51 PM CST | Link *

Blog History