public static OperationResult <T> BranchWhen <T>(this OperationResult <T> prevOperationResult, Predicate <OperationResult <T> > condition, Action <OperationResult <T> > branchAction) => condition.AssertNotNull(nameof(condition)) .Invoke(prevOperationResult.AssertNotNull(nameof(prevOperationResult))) ? prevOperationResult .Branch(branchAction) : prevOperationResult;
public static OperationResult BranchWhen(this OperationResult prevOperationResult, bool condition, Action branchAction) => condition ? prevOperationResult .Branch(branchAction) : prevOperationResult;
public static OperationResult <T> BranchWhen <T>(this OperationResult <T> prevOperationResult, bool condition, Action <OperationResult <T> > branchAction) => condition ? prevOperationResult .Branch(branchAction) : prevOperationResult;
public static OperationResult BranchWhen(this OperationResult prevOperationResult, Predicate condition, Action <OperationResult> branchAction) => condition.AssertNotNull(nameof(condition)) .Invoke() ? prevOperationResult .Branch(branchAction) : prevOperationResult;
public static async Task <OperationResult <T> > BranchWhenAsync <T>(this OperationResult <T> prevOperationResult, AsyncPredicate <OperationResult <T> > condition, Action <OperationResult <T> > branchAction) => await condition.AssertNotNull(nameof(condition)) .Invoke(prevOperationResult.AssertNotNull(nameof(prevOperationResult))) ? prevOperationResult .Branch(branchAction) : prevOperationResult;
public static async Task <OperationResult> BranchWhenAsync(this OperationResult prevOperationResult, AsyncPredicate condition, Action <OperationResult> branchAction) => await condition.AssertNotNull(nameof(condition)) .Invoke() ? prevOperationResult .Branch(branchAction) : prevOperationResult;