/// <summary> Set the value of the property using the set accessor </summary> public static Value SetPropertyValue(Value objectInstance, PropertyInfo propertyInfo, Value[] arguments, Value newValue) { CheckObject(objectInstance, propertyInfo); if (propertyInfo.GetSetMethod() == null) throw new GetValueException("Property does not have a set method"); arguments = arguments ?? new Value[0]; Value[] allParams = new Value[1 + arguments.Length]; allParams[0] = newValue; arguments.CopyTo(allParams, 1); return Value.InvokeMethod(objectInstance, (DebugMethodInfo)propertyInfo.GetSetMethod(), allParams); }
/// <summary> Set the value of the property using the set accessor </summary> public static Value SetPropertyValue(Thread evalThread, Value objectInstance, IProperty propertyInfo, Value[] arguments, Value newValue) { CheckObject(objectInstance, propertyInfo); if (!propertyInfo.CanSet) throw new GetValueException("Property does not have a set method"); arguments = arguments ?? new Value[0]; Value[] allParams = new Value[1 + arguments.Length]; allParams[0] = newValue; arguments.CopyTo(allParams, 1); return Value.InvokeMethod(evalThread, objectInstance, propertyInfo.Setter, allParams); }
/// <summary> Set the value of indexer property </summary> public Value SetValue(Value objectInstance, Value newValue, Value[] parameters) { if (setMethod == null) throw new CannotGetValueException("Property does not have a set method"); parameters = parameters ?? new Value[0]; Value[] allParams = new Value[1 + parameters.Length]; allParams[0] = newValue; parameters.CopyTo(allParams, 1); return setMethod.Invoke(objectInstance, allParams); }