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

            DynamicReflectionDelegateFactory.GenerateCreateSetFieldIL(fieldInfo, dynamicMethod.GetILGenerator());
            return((Action <T, object>)dynamicMethod.CreateDelegate(typeof(Action <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>)));
        }