Example #1
0
 /// <summary>
 /// 设置属性值
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="property"></param>
 /// <param name="value"></param>
 public static void SetPropertyValue(object obj, PropertyInfo property, object value)
 {
     if (property.CanWrite)
     {
         var propertySetter = DynamicCalls.GetPropertySetter(property);
         value = TypeUtils.ConvertForType(value, property.PropertyType);
         propertySetter(obj, value);
     }
 }
Example #2
0
 /// <summary>
 /// 快速实例化一个FastCreateInstanceHandler
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static FastCreateInstanceHandler Create(Type type)
 {
     return(DynamicCalls.GetInstanceCreator(type));
 }
Example #3
0
 /// <summary>
 /// 快速执行Method
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="method"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public static object FastMethodInvoke(object obj, MethodInfo method, params object[] parameters)
 {
     return(DynamicCalls.GetMethodInvoker(method)(obj, parameters));
 }