Ejemplo n.º 1
0
 internal DynamicInstance(IObjectVisitor <T> visitor)
 {
     _visitor = visitor ?? throw new ArgumentNullException(nameof(visitor));
     _gettingMemberHandler = Try.CreateFuture <string, object>(name => _visitor.GetValue(name));
     _settingMemberHandler = Try.Future <string, object>((name, val) => _visitor.SetValue(name, val));
     _lazyObjectGetter     = new Lazy <IObjectGetter <T> >(() => ObjectGetter.Type <T>(_visitor.AlgorithmKind).Instance(_visitor.Instance));
     _lazyObjectSetter     = new Lazy <IObjectSetter <T> >(() => ObjectSetter.Type <T>(_visitor.AlgorithmKind).Instance(_visitor.Instance));
 }
Ejemplo n.º 2
0
 public void SetValue(string propertyName, BindingFlags bindingAttr, object value)
 {
     ObjectSetter.Type(_type).Instance(null).SetValue(propertyName, value);
 }
 /// <summary>
 /// Invoke <br />
 /// 调用
 /// </summary>
 /// <param name="type"></param>
 /// <param name="that"></param>
 /// <param name="propertyName"></param>
 /// <param name="bindingAttr"></param>
 /// <param name="value"></param>
 public void Invoke(Type type, object that, string propertyName, BindingFlags bindingAttr, object value)
 {
     ObjectSetter.Type(type).Instance(that).SetValue(propertyName, value);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Set value <br />
 /// 设置值
 /// </summary>
 /// <param name="propertyName"></param>
 /// <param name="value"></param>
 public void SetValue(string propertyName, object value)
 {
     ObjectSetter.Type(_type).Instance(_instance).SetValue(propertyName, value);
 }