예제 #1
0
            private static Func <Type, bool> BuildIsATypeBuilderInstChecker()
            {
                var dynamicMethod = new DynamicMethod(Guid.NewGuid().ToString(), typeof(bool), new[] { typeof(Type) }, typeof(ReflectionExtensions), true);

                using (var il = new GroboIL(dynamicMethod))
                {
                    il.Ldarg(0);
                    il.Isinst(typeBuilderInstType);
                    il.Ldnull();
                    il.Cgt(true);
                    il.Ret();
                }
                return((Func <Type, bool>)dynamicMethod.CreateDelegate(typeof(Func <Type, bool>)));
            }