PropertyAccessorSetInstanceValueTInstance, TProperty, TIndex(TInstance, TProperty, TIndex) Method

Sets the strongly typed value of a single-parameter indexed property in a reference type. If the type of the property, the declaring instance or the index parameter is not known at compile time, or the indexer has more than one parameter, then the non-generic Set methods can be used.

Definition

Namespace: KGySoft.Reflection
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
C#
public void SetInstanceValue<TInstance, TProperty, TIndex>(
	TInstance instance,
	TProperty value,
	TIndex index
)
where TInstance : class

Parameters

instance  TInstance
The instance that the property belongs to.
value  TProperty
The value to set.
index  TIndex
The value of the index parameter.

Type Parameters

TInstance
The type of the instance that declares the property.
TProperty
The type of the property.
TIndex
The type of the index parameter.

Exceptions

InvalidOperationExceptionThis PropertyAccessor represents a static property or a property of an open generic type.
ArgumentNullExceptioninstance is .
ArgumentExceptionThe number or types of the type arguments are invalid.
NotSupportedExceptionThis PropertyAccessor represents a read-only property or an indexed property with more than one parameter.
PlatformNotSupportedExceptionYou use the .NET Standard 2.0 build of KGySoft.CoreLibraries and this PropertyAccessor represents a ref property.

See Also