Ejemplo n.º 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)
     {
         FastPropertySetHandler propertySetter = DynamicCalls.GetPropertySetter(property);
         value = ConvertValue(property.PropertyType, value);
         propertySetter(obj, value);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 快速实例化一个FastCreateInstanceHandler
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static FastCreateInstanceHandler Create(Type type)
 {
     return(DynamicCalls.GetInstanceCreator(type));
 }
Ejemplo n.º 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));
 }