예제 #1
0
파일: Value.cs 프로젝트: KAW0/Alter-Native
		/// <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);
		}
예제 #2
0
파일: Value.cs 프로젝트: Paccc/SharpDevelop
		/// <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);
		}
예제 #3
0
		/// <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);
		}