Пример #1
0
 /// <summary>
 /// Invokes the factory, using the source as input, suppressing any thrown exception.
 /// </summary>
 /// <param name="default">The result value when not successful.</param>
 public static Task <Attempt <TResult> > AttemptGetAsync <TSource, TResult>(this TSource source,
                                                                            Func <TSource, Task <TResult> > factory,
                                                                            TResult @default = default(TResult))
 {
     return(Attempt.GetAsync(() => factory(source)));
 }
Пример #2
0
 /// <summary>
 /// Invokes the factory, using the source as input, suppressing any thrown exception.
 /// </summary>
 /// <param name="default">The result value when not successful.</param>
 public static Attempt <TResult> AttemptGet <TSource, TResult>(this TSource source, Func <TSource, TResult> factory,
                                                               TResult @default = default(TResult))
 {
     return(Attempt.Get(() => factory(source)));
 }