Export (0) Print
Expand All

FieldBuilder.GetValue Method

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

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public override Object GetValue(
	Object obj
)

Parameters

obj
Type: System.Object
The object on which to access the field.

Return Value

Type: System.Object
An Object containing the value of the field reflected by this instance.

Implements

_FieldInfo.GetValue(Object)

ExceptionCondition
NotSupportedException

This method is not supported.

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 GetValue 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, GetValue 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.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft