Method SetValue
- Namespace
- Microsoft.Samples.Debugging.CorMetadata
- Assembly
- corapi.dll
SetValue(object, object, BindingFlags, Binder, object[], CultureInfo)
When overridden in a derived class, sets the property value for a specified object that has the specified binding, index, and culture-specific information.
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
Parameters
obj
objectThe object whose property value will be set.
value
objectThe new property value.
invokeAttr
BindingFlagsA bitwise combination of the following enumeration members that specify the invocation attribute: InvokeMethod, CreateInstance, Static, GetField, SetField, GetProperty, or SetProperty. You must specify a suitable invocation attribute. For example, to invoke a static member, set the Static flag.
binder
BinderAn object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects through reflection. If
binder
is null, the default binder is used.index
object[]Optional index values for indexed properties. This value should be null for non-indexed properties.
culture
CultureInfoThe culture for which the resource is to be localized. If the resource is not localized for this culture, the Parent property will be called successively in search of a match. If this value is null, the culture-specific information is obtained from the CurrentUICulture property.
Exceptions
- ArgumentException
The
index
array does not contain the type of arguments needed.-or- The property's set accessor is not found. -or-value
cannot be converted to the type of PropertyType.- TargetException
The object does not match the target type, or a property is an instance property but
obj
is null.- TargetParameterCountException
The number of parameters in
index
does not match the number of parameters the indexed property takes.- MethodAccessException
There was an illegal attempt to access a private or protected method inside a class.
- TargetInvocationException
An 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.