Ejemplo n.º 1
0
 /// <summary>
 /// Projects the wrapped value into a new one and wraps it.
 /// </summary>
 /// <typeparam name="TSource">The type of the wrapped value.</typeparam>
 /// <typeparam name="TResult">The type to project the value into.</typeparam>
 /// <param name="source">The wrapper.</param>
 /// <param name="project">A transform function to apply on the wrapped value.</param>
 /// <returns>The projection of the wrapped value in a wrapper.</returns>
 public static Try <TResult> Select <TSource, TResult>(this Try <TSource> source, Func <TSource, TResult> project)
 => source.Bind(val => Try.LiftValue(project(val)));
Ejemplo n.º 2
0
 /// <inheritdoc/>
 public override Try <T> Recover(Func <Exception, T> recoverFn)
 => this.RecoverWith(ex => Try.LiftValue(recoverFn(ex)));