public static T ChooseByDecision <T>(this ApprovalStatus status, T approved, T denied) { status.EnsureIsDecided(); if (status.IsApproved()) { return(approved); } else { return(denied); } }
public static T ChooseByDecision <T>(this ApprovalStatus status, Func <T> approved, Func <T> denied) { status.EnsureIsDecided(); if (status.IsApproved()) { var approvedValue = approved(); return(approvedValue); } else { var deniedValue = denied(); return(deniedValue); } }