Пример #1
0
        public override Action <T, object> CreateSet <T>(PropertyInfo propertyInfo)
        {
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod(string.Concat("Set", propertyInfo.Name), null, new Type[] { typeof(T), typeof(object) }, propertyInfo.DeclaringType);

            DynamicReflectionDelegateFactory.GenerateCreateSetPropertyIL(propertyInfo, dynamicMethod.GetILGenerator());
            return((Action <T, object>)dynamicMethod.CreateDelegate(typeof(Action <T, object>)));
        }
Пример #2
0
        public override MethodCall <T, object> CreateMethodCall <T>(MethodBase method)
        {
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod(method.ToString(), typeof(object), new Type[] { typeof(object), typeof(object[]) }, method.DeclaringType);

            this.GenerateCreateMethodCallIL(method, dynamicMethod.GetILGenerator(), 1);
            return((MethodCall <T, object>)dynamicMethod.CreateDelegate(typeof(MethodCall <T, object>)));
        }
Пример #3
0
        public override ObjectConstructor <object> CreateParameterizedConstructor(MethodBase method)
        {
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod(method.ToString(), typeof(object), new Type[] { typeof(object[]) }, method.DeclaringType);

            this.GenerateCreateMethodCallIL(method, dynamicMethod.GetILGenerator(), 0);
            return((ObjectConstructor <object>)dynamicMethod.CreateDelegate(typeof(ObjectConstructor <object>)));
        }
Пример #4
0
        public override Func <T> CreateDefaultConstructor <T>(Type type)
        {
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod(string.Concat("Create", type.FullName), typeof(T), ReflectionUtils.EmptyTypes, type);

            dynamicMethod.InitLocals = true;
            this.GenerateCreateDefaultConstructorIL(type, dynamicMethod.GetILGenerator(), typeof(T));
            return((Func <T>)dynamicMethod.CreateDelegate(typeof(Func <T>)));
        }
        // Token: 0x06000D7D RID: 3453 RVA: 0x0004E6A4 File Offset: 0x0004C8A4
        public override Func <T> CreateDefaultConstructor <[Nullable(2)] T>(Type type)
        {
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod("Create" + type.FullName, typeof(T), ReflectionUtils.EmptyTypes, type);

            dynamicMethod.InitLocals = true;
            ILGenerator ilgenerator = dynamicMethod.GetILGenerator();

            this.GenerateCreateDefaultConstructorIL(type, ilgenerator, typeof(T));
            return((Func <T>)dynamicMethod.CreateDelegate(typeof(Func <T>)));
        }
Пример #6
0
        public override Func <T, object> CreateGet <T>(FieldInfo fieldInfo)
        {
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod("Get" + fieldInfo.Name, typeof(T), new Type[]
            {
                typeof(object)
            }, fieldInfo.DeclaringType);
            ILGenerator iLGenerator = dynamicMethod.GetILGenerator();

            this.GenerateCreateGetFieldIL(fieldInfo, iLGenerator);
            return((Func <T, object>)dynamicMethod.CreateDelegate(typeof(Func <T, object>)));
        }
        public override Func <T, object> CreateGet <T>(PropertyInfo propertyInfo)
        {
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod("Get" + propertyInfo.Name, typeof(T), new Type[1]
            {
                typeof(object)
            }, propertyInfo.DeclaringType);
            ILGenerator ilGenerator = dynamicMethod.GetILGenerator();

            this.GenerateCreateGetPropertyIL(propertyInfo, ilGenerator);
            return((Func <T, object>)dynamicMethod.CreateDelegate(typeof(Func <T, object>)));
        }
Пример #8
0
        public override Func <T, object> CreateGet <T>(FieldInfo fieldInfo)
        {
            if (fieldInfo.IsLiteral)
            {
                object value = fieldInfo.GetValue(null);
                return((T o) => value);
            }
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod(string.Concat("Get", fieldInfo.Name), typeof(T), new Type[] { typeof(object) }, fieldInfo.DeclaringType);

            this.GenerateCreateGetFieldIL(fieldInfo, dynamicMethod.GetILGenerator());
            return((Func <T, object>)dynamicMethod.CreateDelegate(typeof(Func <T, object>)));
        }
        public override Action <T, object> CreateSet <T>(FieldInfo fieldInfo)
        {
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod("Set" + fieldInfo.Name, (Type)null, new Type[2]
            {
                typeof(T),
                typeof(object)
            }, fieldInfo.DeclaringType);
            ILGenerator ilGenerator = dynamicMethod.GetILGenerator();

            DynamicReflectionDelegateFactory.GenerateCreateSetFieldIL(fieldInfo, ilGenerator);
            return((Action <T, object>)dynamicMethod.CreateDelegate(typeof(Action <T, object>)));
        }
        public override Action <T, object> CreateSet <[Nullable(2)] T>(PropertyInfo propertyInfo)
        {
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod("Set" + propertyInfo.Name, null, new Type[]
            {
                typeof(T),
                typeof(object)
            }, propertyInfo.DeclaringType);

            ILGenerator ilgenerator = dynamicMethod.GetILGenerator();

            DynamicReflectionDelegateFactory.GenerateCreateSetPropertyIL(propertyInfo, ilgenerator);
            return((Action <T, object>)dynamicMethod.CreateDelegate(typeof(Action <T, object>)));
        }
        public override Func <T, object> CreateGet <[Nullable(2)] T>(FieldInfo fieldInfo)
        {
            if (fieldInfo.IsLiteral)
            {
                object constantValue = fieldInfo.GetValue(null);
                return((T o) => constantValue);
            }
            DynamicMethod dynamicMethod = DynamicReflectionDelegateFactory.CreateDynamicMethod("Get" + fieldInfo.Name, typeof(T), new Type[]
            {
                typeof(object)
            }, fieldInfo.DeclaringType);

            ILGenerator ilgenerator = dynamicMethod.GetILGenerator();

            this.GenerateCreateGetFieldIL(fieldInfo, ilgenerator);
            return((Func <T, object>)dynamicMethod.CreateDelegate(typeof(Func <T, object>)));
        }
Пример #12
0
 static DynamicReflectionDelegateFactory()
 {
     Class6.yDnXvgqzyB5jw();
     DynamicReflectionDelegateFactory.Instance = new DynamicReflectionDelegateFactory();
 }