Returning a cast result from a generic method.

I recently needed to cast an object from the Enterprise Library Caching block back to a type, but start getting the popular System.NullReferenceException error in my tests if the value returned from the caching block was null. The problem is that you cannot cast null back to a non-nullable type like an int. The answer […]