ReflectorGetField(Object, FieldInfo, ReflectionWays) Method

Gets a field represented by the specified FieldInfo.

Definition

Namespace: KGySoft.Reflection
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
C#
public static Object? GetField(
	Object? instance,
	FieldInfo field,
	ReflectionWays way = ReflectionWays.Auto
)

Parameters

instance  Object
An instance whose field is about to be retrieved. This parameter is ignored for static fields.
field  FieldInfo
The field to get.
way  ReflectionWays  (Optional)
The preferred reflection way. TypeDescriptor way is not applicable for fields. This parameter is optional.
Default value: Auto.

Return Value

Object
The value of the field.

Remarks

If way is Auto, then the DynamicDelegate way will be used.

  Note

To get the property explicitly by dynamically created delegates use the FieldAccessor class.

See Also