System.Reflection.Emit.FieldBuilder.GetValue Method

Retrieves the value of the field supported by the given object.

Syntax

public override object GetValue (object obj)

Parameters

obj
The object on which to access the field.

Returns

An object containing the value of the field reflected by this instance.

Remarks

If the field is static, the obj parameter is ignored. For non-static fields, obj should be an instance of a class that inherits or declares the field.

The return type of FieldBuilder.GetValue(object) is object. For example, if the field holds a Boolean primitive value, an instance of object with the appropriate Boolean value is returned. Before returning the value, FieldBuilder.GetValue(object) checks to see if the user has access permission.

Access restrictions are ignored for fully-trusted code. Private constructors, methods, fields, and properties can be accessed and invoked using Reflection whenever the code is fully-trusted.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0