public static smTransitionResult DoTransition(this Ism sm, IsmParameter parameter) { switch (sm.State.UnionCase) { case smState.UnionCases.a: { switch (parameter.Trigger.UnionCase) { case smTrigger.UnionCases.atob: return(new smTransition(sm, ((asm)sm).atob((smParameters.atob)parameter), parameter)); default: return(new smInvalidTrigger(sm, parameter)); } } case smState.UnionCases.b: { switch (parameter.Trigger.UnionCase) { default: return(new smInvalidTrigger(sm, parameter)); } } default: throw new ArgumentException($"Unknown type implementing Ism: {sm.GetType().Name}"); } }
public static async Task <T> Match <T>(this Ism sm, Func <asm, Task <T> > a, Func <bsm, Task <T> > b) { switch (sm.State.UnionCase) { case smState.UnionCases.a: return(await a((asm)sm).ConfigureAwait(false)); case smState.UnionCases.b: return(await b((bsm)sm).ConfigureAwait(false)); default: throw new ArgumentException($"Unknown type derived from Ism: {sm.GetType().Name}"); } }
public static T Match <T>(this Ism sm, Func <asm, T> a, Func <bsm, T> b) { switch (sm.State.UnionCase) { case smState.UnionCases.a: return(a((asm)sm)); case smState.UnionCases.b: return(b((bsm)sm)); default: throw new ArgumentException($"Unknown type derived from Ism: {sm.GetType().Name}"); } }