public virtual void StaticValueSet(CLS_Environment environment, string valuename, object value) { var targetp = type.GetProperty(valuename); if (targetp != null) { if (value != null && value.GetType() != targetp.PropertyType) { value = environment.GetType(value.GetType()).ConvertTo(environment, value, targetp.PropertyType); } targetp.SetValue(null, value, null); return; } else { var targetf = type.GetField(valuename); if (targetf != null) { if (value != null && value.GetType() != targetf.FieldType) { value = environment.GetType(value.GetType()).ConvertTo(environment, value, targetf.FieldType); } targetf.SetValue(null, value); return; } } throw new NotImplementedException(); }
public CLS_Content.Value Call(CLS_Environment environment, IList <CLS_Content.Value> param) { CLS_Content.Value v = new CLS_Content.Value(); List <object> objs = new List <object>(); //var _params = dele.Method.GetParameters(); for (int i = 0; i < this.defvalues.Count; i++) { if (i >= param.Count) { objs.Add(defvalues[i]); } else { if (this.paramtype[i] == param[i].type) { objs.Add(param[i].value); } else { object conv = environment.GetType(param[i].type).ConvertTo(environment, param[i].value, paramtype[i]); objs.Add(conv); } } } v.type = this.returntype; v.value = dele.DynamicInvoke(objs.ToArray()); return(v); }
public CLS_Content.Value Call(CLS_Environment environment, IList<CLS_Content.Value> param) { CLS_Content.Value v = new CLS_Content.Value(); List<object> objs = new List<object>(); //var _params = dele.Method.GetParameters(); for (int i = 0; i < this.defvalues.Count; i++) { if (i >= param.Count) { objs.Add(defvalues[i]); } else { if (this.paramtype[i] == param[i].type) { objs.Add(param[i].value); } else { object conv = environment.GetType(param[i].type).ConvertTo(environment, param[i].value, paramtype[i]); objs.Add(conv); } } } v.type = this.returntype; v.value = dele.DynamicInvoke(objs.ToArray()); return v; }
public virtual void StaticValueSet(CLS_Environment environment, string valuename, object value) { var targetp = type.GetProperty(valuename); if (targetp != null) { if (value != null && value.GetType() != targetp.PropertyType) { value = environment.GetType(value.GetType()).ConvertTo(environment, value, targetp.PropertyType); } targetp.SetValue(null, value, null); return; } else { var targetf = type.GetField(valuename); if (targetf != null) { if (value != null && value.GetType() != targetf.FieldType) { value = environment.GetType(value.GetType()).ConvertTo(environment, value, targetf.FieldType); } targetf.SetValue(null, value); return; } } throw new NotImplementedException(); }