DynamicILInfo.GetTokenFor Method (RuntimeFieldHandle)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a token, valid in the scope of the current DynamicILInfo, representing a field to be accessed from the associated dynamic method.

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

public int GetTokenFor(
	RuntimeFieldHandle field


Type: System.RuntimeFieldHandle

The field to be accessed.

Return Value

Type: System.Int32

A token that can be used as the operand of an MSIL instruction that accesses fields, in the scope of the current DynamicILInfo object.

You must obtain a token for any field that will be accessed by the dynamic method associated with the current DynamicILInfo object. Use the Type.GetField method to get a FieldInfo for the field you want to access, then use the FieldHandle property to get the RuntimeFieldHandle.

.NET Framework
Available since 2.0
Return to top