Пример #1
0
 /// <seealso cref="Execute{T1,T2,T3,T4,TResult}"/>
 public static TResult Execute <T1, T2, T3, TResult>(Func <T1, T2, T3, TResult> func,
                                                     T1 arg1,
                                                     T2 arg2,
                                                     T3 arg3)
 {
     return(ExceptionSafe.ExecuteAndIgnore <NullReferenceException, TResult>(() => func(arg1, arg2, arg3)));
 }
Пример #2
0
 /// <summary>
 /// Execute <paramref name="action"/> in a try catch block that will
 /// swallow any <see cref="NullReferenceException"/> that <paramref name="action"/> throws
 /// </summary>
 /// <exception cref="ArgumentNullException">when <paramref name="action"/> is null</exception>
 public static void Execute <T1, T2, T3, T4>(Action <T1, T2, T3, T4> action,
                                             T1 arg1,
                                             T2 arg2,
                                             T3 arg3,
                                             T4 arg4)
 {
     ExceptionSafe.ExecuteAndIgnore <NullReferenceException>(() => action(arg1, arg2, arg3, arg4));
 }
Пример #3
0
 /// <seealso cref="MakeSafe{T1,T2,T3,T4,TResult}"/>
 public static Func <T1, T2, T3, TResult> MakeSafe <T1, T2, T3, TResult>(Func <T1, T2, T3, TResult> func)
 {
     return
         ((arg1, arg2, arg3) =>
          ExceptionSafe.ExecuteAndIgnore <NullReferenceException, TResult>(() => func(arg1, arg2, arg3)));
 }
Пример #4
0
 /// <seealso cref="Execute{T1,T2,T3,T4,TResult}"/>
 public static TResult Execute <TResult>(Func <TResult> func)
 {
     return(ExceptionSafe.ExecuteAndIgnore <NullReferenceException, TResult>(func));
 }
Пример #5
0
 /// <seealso cref="MakeSafe{T1,T2,T3,T4,TResult}"/>
 public static Func <T, TResult> MakeSafe <T, TResult>(Func <T, TResult> func)
 {
     return(arg => ExceptionSafe.ExecuteAndIgnore <NullReferenceException, TResult>(() => func(arg)));
 }