static public TResult Dispatch <TA, TB, TC, TResult>(this IXor3 <TA, TB, TC> _this, Func <TA, TResult> oxFunc1, Func <TB, TResult> oxFunc2, Func <TC, TResult> oxFunc3) { switch (_this.Kind) { case Xor3Enum.A: return(oxFunc1(_this.A)); case Xor3Enum.B: return(oxFunc2(_this.B)); case Xor3Enum.C: return(oxFunc3(_this.C)); default: throw NotPreparedForThatCase.CannotHappenException; } }
public TCommonValue From <TA, TB, TC>(IXor3 <TA, TB, TC> xor3) where TA : TCommonValue where TB : TCommonValue where TC : TCommonValue { if (xor3.IsA) { return(xor3.A); } else if (xor3.IsB) { return(xor3.B); } else { return(xor3.C); } }
public Xor3(IXor3 <TAType, TBType, TCType, TCommon> other) { _obj = other.Common; _enum = other.Kind; }