Bewerken

Share via


_FieldInfo.SetValue Method

Definition

Provides COM objects with version-independent access to the SetValue methods.

Overloads

SetValue(Object, Object)

Provides COM objects with version-independent access to the SetValue(Object, Object) method.

SetValue(Object, Object, BindingFlags, Binder, CultureInfo)

Provides COM objects with version-independent access to the SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo) method.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The SetValue methods set the value of the field for the given object to the given value.

SetValue(Object, Object)

Provides COM objects with version-independent access to the SetValue(Object, Object) method.

public:
 void SetValue(System::Object ^ obj, System::Object ^ value);
public void SetValue (object obj, object value);
abstract member SetValue : obj * obj -> unit
Public Sub SetValue (obj As Object, value As Object)

Parameters

obj
Object

The object whose field value will be set.

value
Object

The value to assign to the field.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The SetValue method sets the value of the field supported by the given object.

Applies to

SetValue(Object, Object, BindingFlags, Binder, CultureInfo)

Provides COM objects with version-independent access to the SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo) method.

public:
 void SetValue(System::Object ^ obj, System::Object ^ value, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, System::Globalization::CultureInfo ^ culture);
public void SetValue (object obj, object value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture);
abstract member SetValue : obj * obj * System.Reflection.BindingFlags * System.Reflection.Binder * System.Globalization.CultureInfo -> unit
Public Sub SetValue (obj As Object, value As Object, invokeAttr As BindingFlags, binder As Binder, culture As CultureInfo)

Parameters

obj
Object

The object whose field value will be set.

value
Object

The value to assign to the field.

invokeAttr
BindingFlags

A field of Binder that specifies the type of binding that is desired (for example, Binder.CreateInstance or Binder.ExactBinding).

binder
Binder

A set of properties that enables the binding, coercion of argument types, and invocation of members through reflection. If binder is null, then Binder.DefaultBinding is used.

culture
CultureInfo

The software preferences of a particular culture.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The SetValue method sets the value of the field supported by the given object.

Applies to