public abstract SetValue ( object obj, object val ) : void | ||
obj | object | |
val | object | |
return | void |
/// <summary> 设置一个类变量 </summary> public override void SetValue(object obj, string name, ScriptObject value) { UserdataVariable variable = GetVariable(name); if (variable == null) { throw new ExecutionException(m_Script, "SetValue Type[" + m_Type + "] 变量 [" + name + "] 不存在"); } try { variable.SetValue(obj, Util.ChangeType(m_Script, value, variable.FieldType)); } catch (System.Exception e) { throw new ExecutionException(m_Script, "SetValue 出错 源类型:" + (value == null || value.IsNull ? "null" : value.ObjectValue.GetType().Name) + " 目标类型:" + variable.FieldType.Name + " : " + e.ToString()); } }
public override void SetValue_impl(object obj, string name, ScriptObject value) { UserdataVariable variable = this.GetVariable(name); if (variable == null) { throw new ExecutionException(base.m_Script, string.Concat(new object[] { "SetValue Type[", base.m_Type, "] 变量 [", name, "] 不存在" })); } try { variable.SetValue(obj, Util.ChangeType(base.m_Script, value, variable.FieldType)); } catch (Exception exception) { throw new ExecutionException(base.m_Script, "SetValue 出错 源类型:" + (((value == null) || value.IsNull) ? "null" : value.ObjectValue.GetType().Name) + " 目标类型:" + variable.FieldType.Name + " : " + exception.ToString()); } }