ReflectorSetIndexedMember(Object, Object, ReflectionWays, Object) Method

Sets the value of an indexable object. It can be either an array instance or an object with default members (indexed properties).

Definition

Namespace: KGySoft.Reflection
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public static void SetIndexedMember(
	Object instance,
	Object? value,
	ReflectionWays way,
	params Object?[] indexParameters
)

Parameters

instance  Object
An instance to be set.
value  Object
The value to set.
way  ReflectionWays
The preferred reflection way. TypeDescriptor way is not applicable here. This parameter is ignored for arrays.
indexParameters  Object
The index parameters.

Remarks

This method ignores explicitly implemented interface properties.

If you already have a PropertyInfo instance of the indexed property, then use the SetProperty(Object, PropertyInfo, Object, ReflectionWays, Object) method for better performance.

If way is Auto, then the DynamicDelegate way will be used.

  Tip

To preserve the changes of a mutable value type embed it into a variable of Object type and pass it to the instance parameter of this method.

See Also