コード例 #1
0
        public static FSharpChoice <TR1, TR2, TR3, TR4> Transform <T1, T2, T3, T4, TR1, TR2, TR3, TR4>(this FSharpChoice <T1, T2, T3, T4> choice, Func <T1, TR1> func1, Func <T2, TR2> func2, Func <T3, TR3> func3, Func <T4, TR4> func4)
        {
            switch (choice.Tag)
            {
            case FSharpChoice <T1, T2, T3, T4> .Tags.Choice1Of4:
                return(FSharpChoice <TR1, TR2, TR3, TR4> .NewChoice1Of4(func1((choice.CastTo <FSharpChoice <T1, T2, T3, T4> .Choice1Of4>()).Item)));

            case FSharpChoice <T1, T2, T3, T4> .Tags.Choice2Of4:
                return(FSharpChoice <TR1, TR2, TR3, TR4> .NewChoice2Of4(func2((choice.CastTo <FSharpChoice <T1, T2, T3, T4> .Choice2Of4>()).Item)));

            case FSharpChoice <T1, T2, T3, T4> .Tags.Choice3Of4:
                return(FSharpChoice <TR1, TR2, TR3, TR4> .NewChoice3Of4(func3((choice.CastTo <FSharpChoice <T1, T2, T3, T4> .Choice3Of4>()).Item)));

            case FSharpChoice <T1, T2, T3, T4> .Tags.Choice4Of4:
                return(FSharpChoice <TR1, TR2, TR3, TR4> .NewChoice4Of4(func4((choice.CastTo <FSharpChoice <T1, T2, T3, T4> .Choice4Of4>()).Item)));
            }
            throw new InvalidOperationException();
        }