Esempio n. 1
0
        /// <summary>
        /// 快速调用PropertyInfo的SetValue方法
        /// </summary>
        /// <param name="propertyInfo"></param>
        /// <param name="obj"></param>
        /// <param name="value"></param>
        public static void FastSetValue(this PropertyInfo propertyInfo, object obj, object value)
        {
            if (propertyInfo == null)
            {
                throw new ArgumentNullException("propertyInfo");
            }

            GetterSetterFactory.GetPropertySetterWrapper(propertyInfo).Set(obj, value);
        }
Esempio n. 2
0
        /// <summary>
        /// 快速调用PropertyInfo的GetValue方法
        /// </summary>
        /// <param name="propertyInfo"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static object FastGetValue(this PropertyInfo propertyInfo, object obj)
        {
            if (propertyInfo == null)
            {
                throw new ArgumentNullException("propertyInfo");
            }

            return(GetterSetterFactory.GetPropertyGetterWrapper(propertyInfo).Get(obj));
        }