System.Reflection.MonoField.SetValue C# (CSharp) Method

SetValue() public method

public SetValue ( object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture ) : void
obj object
val object
invokeAttr BindingFlags
binder Binder
culture System.Globalization.CultureInfo
return void
		public override void SetValue (object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
		{
			if (!IsStatic && obj == null)
				throw new TargetException ("Non-static field requires a target");
			if (IsLiteral)
				throw new FieldAccessException ("Cannot set a constant field");
			if (binder == null)
				binder = Binder.DefaultBinder;
			CheckGeneric ();
			if (val != null) {
				object newVal;
				newVal = binder.ChangeType (val, type, culture);
				if (newVal == null)
					throw new ArgumentException ("Object type " + val.GetType() + " cannot be converted to target type: " + type, "val");
				val = newVal;
			}
			SetValueInternal (this, obj, val);
		}