Returns the value of a field supported by a given object.
[Visual Basic] MustOverride Public Function GetValue( _ ByVal obj As Object _ ) As Object [C#] public abstract object GetValue( object obj ); [C++] public: virtual Object* GetValue( Object* obj ) = 0; [JScript] public abstract function GetValue( obj : Object ) : Object;
A Variant containing the value of the field reflected by this instance.
Exception Type | Condition |
---|---|
AccessException | The caller does not have permission to access this field. For example, this field may be private. |
TargetException | The method is non-static and obj is a null reference.
The method is neither declared nor inherited by the class of obj. |
If the field is static, obj is ignored. For non-static fields, obj should be an instance of a class that inherits or declares the field. Note that the return type of GetValue is Variant. For example, if the field holds a Boolean primitive value, an instance of Variant with the appropriate Boolean value is returned. Before returning the value, GetValue checks to see if the user has access permission.
Note Access restrictions are ignored for fully trusted code. That is, private constructors, methods, fields, and properties can be accessed and invoked through reflection whenever the code is fully trusted.
FieldInfo Class | FieldInfo Members | System.Reflection Namespace | Variant