PropertyAccessorGetInstanceValueTInstance, TProperty, TIndex(TInstance, TIndex) Method

Gets the strongly typed value of a single-parameter indexed property in a value 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 TProperty GetInstanceValue<TInstance, TProperty, TIndex>(
	 in TInstance instance,
	TIndex index
)
where TInstance : struct, new()

Parameters

instance  TInstance
The instance that the property belongs to.
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.

Return Value

TProperty
The value 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 write-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