public Try(Func <TResult> function) : base() { Results = new TryResult <object> [1]; TResult resultObject; Success = TryUtility.Try(function, out resultObject); Results[0] = new TryResult <object>(resultObject, Success); }
public bool Equals(TryResult <TResult> tryResult) { if ((object)tryResult == null) { return(false); } return(Success == tryResult.Success && Object.Equals(tryResult.Object)); }
public Try With(Action action) { var results = new TryResult[Results.Length + 1]; Results.CopyTo(results, 0); results[results.Length - 1] = new Try(action).Results[0]; return(new Try(results)); }
public Try <TResultNew> With <TResultNew>(Func <TResultNew> function) { var results = new TryResult <object> [Results.Length + 1]; Results.CopyTo(results, 0); var result = new Try <TResultNew>(function); results[results.Length - 1] = new TryResult <object>(result.Result.Object, result.Result.Success); return(new Try <TResultNew>(results)); }
public Try() { Results = new TryResult[1]; Results[0] = new TryResult(false); }
public Try(Action action) { Results = new TryResult[1]; Results[0] = new TryResult(TryUtility.Try(action)); }
protected Try(TryResult[] results) { Results = new TryResult[results.Length]; results.CopyTo(Results, 0); }
public Try() : base() { Results = new TryResult <object> [1]; Results[Results.Length - 1] = new TryResult <object>(default(TResult), false); }
protected Try(TryResult <object>[] results) : base(results) { Results = new TryResult <object> [results.Length]; results.CopyTo(Results, 0); }