Esempio n. 1
0
        private static PropertyAccessItem CreatePropertyAccessItem(Type objectType, PropertyInfo propertyInfo)
        {
            PropertyAccessItem propertyAccessItem = new PropertyAccessItem();

            if (propertyInfo.CanRead)
            {
                propertyAccessItem.Getter = DynamicMethodCompiler.CreateGetHandler(objectType, propertyInfo);
            }
            if (propertyInfo.CanWrite)
            {
                propertyAccessItem.Setter = DynamicMethodCompiler.CreateSetHandler(objectType, propertyInfo);
            }
            return(propertyAccessItem);
        }
Esempio n. 2
0
        private static object GetPropertyValue(object @object, PropertyInfo propertyInfo, Type objectType)
        {
            PropertyAccessItem propertyAccessItem = GetPropertyAccessItem(objectType, propertyInfo);

            return(propertyAccessItem.Getter.Invoke(@object));
        }
Esempio n. 3
0
        public static void SetPropertyValue(object @object, Type objectType, PropertyInfo propertyInfo, object value)
        {
            PropertyAccessItem propertyAccessItem = GetPropertyAccessItem(objectType, propertyInfo);

            propertyAccessItem.Setter.Invoke(@object, value);
        }