示例#1
0
        private TResult DetermineResultUsingDefaultIfRequired(IUnion <T1, T2, T3, T4> union)
        {
            switch (union.Case)
            {
            case Case1: return(_case1Selector.DetermineResultUsingDefaultIfRequired(union.Case1));

            case Case2: return(_case2Selector.DetermineResultUsingDefaultIfRequired(union.Case2));

            case Case3: return(_case3Selector.DetermineResultUsingDefaultIfRequired(union.Case3));

            default: return(_case4Selector.DetermineResultUsingDefaultIfRequired(union.Case4));
            }
        }
示例#2
0
 TResult ISuccessFuncMatcher <T, TResult> .Result() => _union.Case == Variant.Case1
     ? _case1FunctionSelector.DetermineResultUsingDefaultIfRequired(_union.Case1)
     : _case2FunctionSelector.DetermineResultUsingDefaultIfRequired(_union.Case2);
示例#3
0
 TResult IValueOrErrorFuncMatcher <TResult> .Result()
 {
     return(_valueOrError.HasValue
         ? _valueFunctionSelector.DetermineResultUsingDefaultIfRequired(_valueOrError.Value)
         : _errorFunctionSelector.DetermineResultUsingDefaultIfRequired(_valueOrError.Error));
 }
 TResult IOptionFuncMatcher <T, TResult> .Result()
 {
     return(_union.Case == Variant.Case1
         ? _case1FunctionSelector.DetermineResultUsingDefaultIfRequired(_union.Case1)
         : _case2FunctionSelector.DetermineResultUsingDefaultIfRequired(_union.Case2));
 }