Click or drag to resize
PropertyInfoSetValue Method (Object, Object, Object)
Sets the value of the property with optional index values for index properties.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public virtual void SetValue(
	Object obj,
	Object value,
	Object[] index
)

Parameters

obj
Type: SystemObject
The object whose property value will be set.
value
Type: SystemObject
The new value for this property.
index
Type: SystemObject
Optional index values for indexed properties. This value should be null for non-indexed properties.
Exceptions
ExceptionCondition
ArgumentExceptionThe index array does not contain the type of arguments needed.-or- The property's set accessor is not found.
TargetExceptionThe object does not match the target type, or a property is an instance property but obj is null.
TargetParameterCountExceptionThe number of parameters in index does not match the number of parameters the indexed property takes.
MethodAccessExceptionThere was an illegal attempt to access a private or protected method inside a class.
TargetInvocationExceptionAn error occurred while setting the property value. For example, an index value specified for an indexed property is out of range. The InnerException property indicates the reason for the error.
See Also