Calling Extension Methods On Null Objects
One of the gotchas for Extension Methods is that it’s legal to call them on Null References. This isn’t really surprising when you think about the feature. Boiled down to a fundamental level, extension methods are just syntactic sugar for calling a static method and automatically passing the first parameter 1. However it can catch the unwary off guard.
-
Then again you could also claim that instance methods are just syntactic sugar for calling static methods without having to pass this/Me as the first parameter. ↩