Mono Class Library: System.Reflection.FieldInfo Overview | Members

System.Reflection.FieldInfo.GetValue Method

Obtains the value of the field that is reflected by the current instance and contained in the specified object. [Edit]

public abstract object GetValue (object obj)

Parameters

obj
An object that contains the field value to be returned. If the field reflected by the current instance is static, obj is ignored. For non-static fields, obj is required to be an instance of a class that inherits or declares the field. [Edit]

Returns

A object that contains the value of the field reflected by the current instance. [Edit]

Permissions

TypeReason
System.Security.Permissions.ReflectionPermission [Edit] Requires permission to access non-public members of a type in loaded assemblies. See System.Security.Permissions.ReflectionPermissionFlag.MemberAccess.

Exceptions

TypeReason
NotSupportedExceptionA field is marked literal, but the field does not have one of the accepted literal types.
Note: For information regarding the accepted literal types, see Partition II of the CLI Specification.
[Edit]
FieldAccessExceptionThe field reflected by the current instance is non-public, and the caller does not have permission to access non-public members. [Edit]
ArgumentExceptionThe field reflected by the current instance is declared neither directly in obj nor in any class from which obj derives. [Edit]
System.Reflection.TargetExceptionThe field reflected by the current instance is non-static, and obj is null. [Edit]

Remarks

Operation
Before returning the value, the system checks to see if the user has access permission. [Edit]

Requirements

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