示例#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>)));
        }
        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>)));
        }