public void Run(ExecutionContextLightup executionContext, Action<object> callback, object state)
        {
            if (LightupType.ExecutionContext == null || LightupType.ContextCallback == null)
                throw new PlatformNotSupportedException();

            // Replace the Action<object> with a ContextCallback
            Delegate contextCallback = LightupServices.ReplaceWith(callback, LightupType.ContextCallback);

            Type actionRepresentingSignature = typeof(Action<,,>).MakeGenericType(LightupType.ExecutionContext, LightupType.ContextCallback, typeof(object));

            Delegate d = GetMethodAccessor(ref _run, actionRepresentingSignature, "Run");
            d.DynamicInvoke(executionContext._executionContext, contextCallback, state);
        }
        public static ThreadLightup Create(Action <object> start)
        {
            Type delegateType = LightupType.ParameterizedThreadStart;

            if (delegateType == null)
            {
                throw new InvalidOperationException();
            }

            // Replace the Action<object> with a ParameterizedThreadStart
            Delegate parameterizedThreadStart = LightupServices.ReplaceWith(start, delegateType);

            Thread thread = Create <Thread>(parameterizedThreadStart);

            return(new ThreadLightup(thread));
        }
        public void Run(ExecutionContextLightup executionContext, Action <object> callback, object state)
        {
            if (LightupType.ExecutionContext == null || LightupType.ContextCallback == null)
            {
                throw new PlatformNotSupportedException();
            }
            Delegate dlg  = LightupServices.ReplaceWith(callback, LightupType.ContextCallback);
            Type     type = typeof(Action <, ,>).MakeGenericType(new Type[]
            {
                LightupType.ExecutionContext,
                LightupType.ContextCallback,
                typeof(object)
            });
            Delegate methodAccessor = base.GetMethodAccessor(ref _run, type, "Run", true);

            methodAccessor.DynamicInvoke(new object[]
            {
                executionContext._executionContext,
                dlg,
                state
            });
        }