ReflectorSetProperty(Object, PropertyInfo, Object, ReflectionWays, Object) Method

Sets a property represented by the specified PropertyInfo.

Definition

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

Parameters

instance  Object
An instance whose property is about to be set. This parameter is ignored for static properties.
property  PropertyInfo
The property to set.
value  Object
The value to set.
way  ReflectionWays
The preferred reflection way. TypeDescriptor way is not applicable here.
indexParameters  Object
Index parameters if property is an indexer. This parameter is ignored for non-indexed properties.

Remarks

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.

  Note

To set the property explicitly by dynamically created delegates use the PropertyAccessor class.

See Also