コード例 #1
0
 /// <summary>
 ///     为当前字段设置值
 /// </summary>
 /// <param name="instance">对象实例</param>
 /// <param name="args">值</param>
 public void SetValue(object instance, params object[] args)
 {
     if (_delegate == null)
     {
         MethodInfo methodInfo = Property.GetSetMethod(true);
         _delegate = DynamicHelper.GetMethodInvoker(methodInfo);
     }
     _delegate(instance, args);
 }
コード例 #2
0
 /// <summary>
 ///     获取当前字段值
 /// </summary>
 /// <param name="instance">对象实例</param>
 /// <returns>值</returns>
 public Object GetValue(Object instance)
 {
     if (_getDelegate == null)
     {
         MethodInfo methodInfo = Property.GetGetMethod(true);
         _getDelegate = DynamicHelper.GetMethodInvoker(methodInfo);
     }
     return(_getDelegate(instance, null));
 }