Пример #1
0
        private Func <TA, TB> CreateFunc <TA, TB>(Action <OptimisingEmitter <Func <TA, TB> > > act)
        {
            var emitter = Emit <Func <TA, TB> > .NewDynamicMethod(strictBranchVerification : true);

            using (var optim = new OptimisingEmitter <Func <TA, TB> >(emitter))
            {
                optim.LoadArgument(0);
                act(optim);
                optim.Return();
            }

            return(emitter.CreateDelegate());
        }