Extension methods can be invoked on null objects (the object gets passed to the static method and you can check for null in the extension itself).
Strange, but does enable some interesting syntactic sugar checking for empty values etc.
Strange, but does enable some interesting syntactic sugar checking for empty values etc.
So then you can say if(foo.Exists()) { foo.bar(); }
Or make Exists return an instance of Foo (foo if not null, a new Foo if not) and go with foo.Exists().bar();