/// <summary> /// 使用表达式树的方式来赋值 /// </summary> /// <param name="propertyInfo">属性值类型</param> /// <param name="instance"></param> /// <param name="setValue"></param> /// <returns>强类型委托</returns> public static void SetValue(PropertyInfo propertyInfo, object instance, object setValue) => ReflectionPropertyInfo.SetValue(propertyInfo)(instance, setValue);
/// <summary> /// 使用表达式树的方式来读取 /// </summary> /// <param name="propertyInfo">属性值类型</param> /// <param name="instance"></param> /// <returns>强类型委托</returns> public static object GetValue(PropertyInfo propertyInfo, object instance) => ReflectionPropertyInfo.GetValue(propertyInfo)(instance);