AsyncDolls.AsyncStateWithDollsTyped.ElementInstance.CreateInvoker C# (CSharp) Method

CreateInvoker() static private method

static private CreateInvoker ( ILinkElement step ) : IStepInvoker
step ILinkElement
return IStepInvoker
        static IStepInvoker CreateInvoker(ILinkElement step)
        {
            var behaviorInterface = step.GetType().GetInterfaces().First(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(ILinkElement<,>));
            var invokerType = typeof(StepInvoker<,>).MakeGenericType(behaviorInterface.GetGenericArguments());
            return (IStepInvoker)Activator.CreateInstance(invokerType);
        }