Tip
If you know the type of the field at compile time (and also the declaring type for instance fields),
then you can use the generic GetStaticValue
or GetInstanceValue methods for better performance.
public Object? Get(
Object? instance
)
Public Function Get (
instance As Object
) As Object
public:
Object^ Get(
Object^ instance
)
member Get :
instance : Object -> Object
Getting the field for the first time is slower than the System.Reflection.FieldInfo.GetValue method but further calls are much faster.
InvalidOperationException | This FieldAccessor represents a field of an open generic type. |
ArgumentNullException | This FieldAccessor represents an instance field and instance is . |
ArgumentException | The type of instance is invalid. |
NotSupportedException | On .NET Framework the code is executed in a partially trusted domain with insufficient permissions. |