PropertyAccessorGet(Object, Object) Method
Gets the value of the property.
For static properties the instance parameter is omitted (can be ).
If the property is not an indexer, then indexParameters parameter is omitted.
Namespace: KGySoft.ReflectionAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
public Object? Get(
Object? instance,
params Object?[]? indexParameters
)
Public Function Get (
instance As Object,
ParamArray indexParameters As Object()
) As Object
public:
Object^ Get(
Object^ instance,
... array<Object^>^ indexParameters
)
member Get :
instance : Object *
indexParameters : Object[] -> Object
- instance Object
- The instance that the property belongs to. Can be for static properties.
- indexParameters Object
- The parameters if the property is an indexer.
ObjectThe value of the property.
Getting the property for the first time is slower than the System.Reflection.PropertyInfo.GetValue
method but further calls are much faster.
If the property has no more than one index parameters and you know the type of the property at compile time
(and also the declaring type for instance properties), then you can use the generic
GetStaticValue
or
GetInstanceValue methods for better performance.
If the property is a a non-readonly instance property of a value type, then the .NET Standard 2.0 version of this method defaults to use regular reflection
to preserve possible mutations. To experience the best performance try to target .NET Standard 2.1 or any .NET Framework or .NET Core/.NET platforms instead.