FieldInfo.GetFieldFromHandle Method (RuntimeFieldHandle)

Gets a FieldInfo for the field represented by the specified handle.

Namespace:  System.Reflection
Assemblies:   System.Reflection (in System.Reflection.dll)
  mscorlib (in mscorlib.dll)

public static FieldInfo GetFieldFromHandle(
	RuntimeFieldHandle handle


Type: System.RuntimeFieldHandle

A RuntimeFieldHandle structure that contains the handle to the internal metadata representation of a field.

Return Value

Type: System.Reflection.FieldInfo
A FieldInfo object representing the field specified by handle.


handle is invalid.

Handles are valid only in the application domain in which they were obtained.

The following code example uses the Type.GetFields method to get FieldInfo objects for the fields of a type, gets a RuntimeFieldHandle structure for each field, and then retrieves the FieldInfo objects from the handles using this overload of the GetFieldFromHandle method.

using System;
using System.Reflection;

public class FieldInfo_GetFieldFromHandle
    public string x;
    public char y;
    public float a;
    public int b;

    public static void Main()
        // Get the type of the FieldInfo_GetFieldFromHandle class.
        Type myType = typeof(FieldInfo_GetFieldFromHandle);
        // Get the fields of the FieldInfo_GetFieldFromHandle class.
        FieldInfo [] myFieldInfoArray = myType.GetFields();
        Console.WriteLine("\nThe field information of the declared" +
            " fields x, y, a, and b is:\n");
        RuntimeFieldHandle myRuntimeFieldHandle;
        for(int i = 0; i < myFieldInfoArray.Length; i++)
            // Get the RuntimeFieldHandle of myFieldInfoArray.
            myRuntimeFieldHandle = myFieldInfoArray[i].FieldHandle;
            // Call the GetFieldFromHandle method. 
            FieldInfo myFieldInfo = FieldInfo.GetFieldFromHandle(myRuntimeFieldHandle);
            // Display the FieldInfo of myFieldInfo.
            Console.WriteLine("{0}", myFieldInfo);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft