Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Sets the property value of a specified object with optional index values for index properties.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Overridable Sub SetValue ( _
obj As Object, _
value As Object, _
index As Object() _
)
public virtual void SetValue(
Object obj,
Object value,
Object[] index
)
public:
virtual void SetValue(
Object^ obj,
Object^ value,
array<Object^>^ index
)
abstract SetValue :
obj:Object *
value:Object *
index:Object[] -> unit
override SetValue :
obj:Object *
value:Object *
index:Object[] -> unit
public function SetValue(
obj : Object,
value : Object,
index : Object[]
)
Parameters
- obj
Type: System. . :: . .Object
The object whose property value will be set.
- value
Type: System. . :: . .Object
The new property value.
- index
Type: array<System. . :: . .Object> [] () [] []
Optional index values for indexed properties. This value should be nullNothingnullptrunita null reference (Nothing in Visual Basic) for non-indexed properties.
Remarks
If this PropertyInfo object is a value type and value is null Nothing nullptr unit a null reference (Nothing in Visual Basic) , then the property will be set to the default value for that type.
To determine whether a property is indexed, use the GetIndexParameters method. If the resulting array has 0 (zero) elements, the property is not indexed.
This is a convenience method that calls the runtime implementation of the abstract SetValue(Object, Object, BindingFlags, Binder, array<Object>[]()[][], CultureInfo) method, specifying BindingFlags..::..Default for the BindingFlags parameter, null Nothing nullptr unit a null reference (Nothing in Visual Basic) for Binder, and null Nothing nullptr unit a null reference (Nothing in Visual Basic) for CultureInfo.
To use the SetValue method, first get a Type object that represents the class. From the Type, get the PropertyInfo. From the PropertyInfo, use the SetValue method.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.