Ejemplo n.º 1
0
 public static TResult Unify <T1, T2, TResult>(this DiscriminatedUnionClass <T1, T2> union, Func <T1, TResult> f1, Func <T2, TResult> f2)
 {
     return(union.Item == 1
                     ? f1(union.Item1)
                     : f2(union.Item2)
            );
 }
Ejemplo n.º 2
0
 public static IObservable <DiscriminatedUnionClass <T1, T2> > DiscriminatedUnion <T1, T2>(this IObservable <T1> a, IObservable <T2> b)
 {
     return(Observable.Merge(
                a.Select(t1 => DiscriminatedUnionClass <T1, T2> .Create(t1)),
                b.Select(t2 => DiscriminatedUnionClass <T1, T2> .Create(t2))
                ));
 }