System.Reflection.Module.ResolveField Method

Returns the field identified by the specified metadata token.

Syntax

public FieldInfo ResolveField (int metadataToken)

Parameters

metadataToken
A metadata token that identifies a field in the module.

Returns

A System.Reflection.FieldInfo object representing the field that is identified by the specified metadata token.

Remarks

To resolve a metadata token that identifies a field whose parent TypeSpec has a signature containing element type ELEMENT_TYPE_VAR or ELEMENT_TYPE_MVAR, use the Module.ResolveField(int, Type[], Type[]) method overload, which allows you to supply the necessary context. That is, when you are resolving a metadata token for a field that depends on the generic type parameters of the generic type and/or the generic method in which the token is embedded, you must use the overload that allows you to supply those type parameters.

Note:

Information about metadata tokens can be found in the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics". The documentation is available online; see tp://go.microsoft.com/fwlink/?LinkID=99212 on MSDN and tp://go.microsoft.com/fwlink/?LinkID=65552 on the ECMA Web site.

For code that demonstrates token resolution using the generic context (that is, the generic type parameters of the generic type and/or the generic method in which the token is embedded) see the Module.ResolveMethod(int, Type[], Type[]) method.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0