Ever wrote something like this? if (a != null && a.b != null && a.b.c != null ) result = a.b.c.d; else result = null ; I hate it. Given that I'm processing some XML files whose schemas I cannot change, there's not much to be done but bite the bullet. This page gave me the idea for the following helper functions: public static T Eval<T, ExceptionClass>(Func<T> func, Func<ExceptionClass, T> onError) where ExceptionClass: Exception { try { return func(); } catch (ExceptionClass e) { return onError(e); } } public static T Eval<T>(Func<T> func, Func<Exception, T> onError) { return Eval<T, Exception>(func, onError); } public static T Eval<T>(Func<T> func, T defaultValue) { return Eval<T, Exception>(func, e => defaultValue); } Now I can write this: result = Helper.Eval(() => a.b.c.d, null );