Extension Methods - IsNull and IsNotNull, good or bad use?
c#, extension-methods
Solution
It doesn't seem any more readable and could confuse people reading the code, wondering if there's any logic they're unaware of in those methods.
I have used a PerformIfNotNull(Func method) (as well as an overload that takes an action) which I can pass a quick lambda expression to replace the whole if block, but if you're not doing anything other than checking for null it seems like it's not providing anything useful.
Problem
I like readability. So, I came up with an extension mothod a few minutes ago for the (x =! null) type syntax, called IsNotNull. Inversly, I also created a IsNull extension method, thus ``` if(x == null) becomes if(x.IsNull()) ``` and ``` if(x != null) becomes if(x.IsNotNull()) ``` However, I'm worried I might be abusing extension methods. Do you think that this is bad use of Extenion methods?