/// <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)); }
/// <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"); } if (value is DBNull) { value = null; } GetterSetterFactory.GetPropertySetterWrapper(propertyInfo).Set(obj, value); }