IronPython.Runtime.Types.ReflectedField.SetValue C# (CSharp) Метод

SetValue() публичный Метод

This function can be used to set a field on a value type without emitting a warning. Otherwise it is provided only to have symmetry with properties which have GetValue/SetValue for supporting explicitly implemented interfaces. Setting fields on value types usually warns because it can silently fail to update the value you expect. For example consider this example where Point is a value type with the public fields X and Y: arr = System.Array.CreateInstance(Point, 10) arr[0].X = 42 print arr[0].X prints 0. This is because reading the value from the array creates a copy of the value. Setting the value then mutates the copy and the array does not get updated. The same problem exists when accessing members of a class.
public SetValue ( Microsoft.Scripting.CodeContext context, object instance, object value ) : void
context Microsoft.Scripting.CodeContext
instance object
value object
Результат void
        public void SetValue(CodeContext context, object instance, object value) {
            if (!TrySetValueWorker(context, instance, DynamicHelpers.GetPythonType(instance), value, true)) {
                throw new InvalidOperationException("cannot set field");
            }            
        }