public static TryOperationResult <T> SuccessFrom(T i) { var result = new TryOperationResult <T>(); result.SetSuccess(i); return(result); }
public static TryOperationResult <T> Run(Func <T> work) { var result = new TryOperationResult <T>(); try { result.SetSuccess(work()); } catch (Exception ex) { result.SetFailure(ex); } return(result); }