using System; namespace OpenCover.Framework { internal static class HelperExtensions { public static TRet Maybe(this T value, Func action, TRet defValue = default(TRet)) where T : class { return (value != null) ? action(value) : defValue; } public static T Do(this T value, Action action) where T : class { if (value != null) action(value); return value; } public static T Try(this T value, Action action) where T : class { try { if (value != null) action(value); } catch (Exception) { // ignore error } return value; } } }