In some cases, it would be nice if you could define default behavior for statically typed null references. Using extension methods, in many cases this can be effectively achieved. However, there are some errors. For example, casting an object to an unrelated type is usually prohibited in .net languages, since there are no cases where such behavior would be legal at run time. On the other hand, if the object was null, it could be passed to the object, and then the null object could be transferred to another type. If the result of such a cast can be considered the default instance of the latter type, the effect will be to make the cast semi-legal.
supercat
source share