Пример #1
0
        public static T ChooseByDecision <T>(this ApprovalStatus status,
                                             T approved,
                                             T denied)
        {
            status.EnsureIsDecided();

            if (status.IsApproved())
            {
                return(approved);
            }
            else
            {
                return(denied);
            }
        }
Пример #2
0
        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);
            }
        }