PropertyAccessorSetInstanceValueTInstance, TProperty(TInstance, TProperty) Method

Sets the strongly typed value of a non-indexed instance property in a value type. If the type of the property or the declaring instance is not known at compile time 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>(
	 in TInstance instance,
	TProperty value
)
where TInstance : struct, new()

Parameters

instance  TInstance
The instance that the property belongs to.
value  TProperty
The value to set.

Type Parameters

TInstance
The type of the instance that declares the property.
TProperty
The type of the property.

Exceptions

InvalidOperationExceptionThis PropertyAccessor represents a static property or a property of an open generic type.
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