Exemple #1
0
        public static async System.Threading.Tasks.Task <R> MatchAsync <R>(this IAskQuestionResult self, System.Func <QuestionAdded, System.Threading.Tasks.Task <R> > whenQuestionAdded, System.Func <QuestionNotAdded, System.Threading.Tasks.Task <R> > whenQuestionNotAdded, System.Func <QuestionValidationFailed, System.Threading.Tasks.Task <R> > whenQuestionValidationFailed)
        {
            switch ((self))
            {
            case QuestionAdded questionadded:
                return(await whenQuestionAdded(questionadded));

            case QuestionNotAdded questionnotadded:
                return(await whenQuestionNotAdded(questionnotadded));

            case QuestionValidationFailed questionvalidationfailed:
                return(await whenQuestionValidationFailed(questionvalidationfailed));

            default:
                throw new System.NotSupportedException("This switch statement should be exhaustive");
            }
        }
Exemple #2
0
        public static IAskQuestionResult Match(this IAskQuestionResult self, System.Func <QuestionAdded, IAskQuestionResult> whenQuestionAdded, System.Func <QuestionNotAdded, IAskQuestionResult> whenQuestionNotAdded, System.Func <QuestionValidationFailed, IAskQuestionResult> whenQuestionValidationFailed)
        {
            switch ((self))
            {
            case QuestionAdded questionadded:
                return(whenQuestionAdded(questionadded));

            case QuestionNotAdded questionnotadded:
                return(whenQuestionNotAdded(questionnotadded));

            case QuestionValidationFailed questionvalidationfailed:
                return(whenQuestionValidationFailed(questionvalidationfailed));

            default:
                throw new System.NotSupportedException("This switch statement should be exhaustive");
            }
        }