FieldHandle Property

FieldInfo.FieldHandle Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets a handle to the internal metadata representation of a field.

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

public abstract RuntimeFieldHandle FieldHandle { get; }

Property Value

Type: System.RuntimeFieldHandle
A handle to the internal metadata representation of a field.


This member is invoked late-bound through mechanisms such as Type.InvokeMember.

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

The following example retrieves field information for MyField, in MyClass, and displays the field associated with the field handle.

using System;
using System.Reflection;

public class MyClass
   public string MyField = "Microsoft";

public class Example
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)

      MyClass myClass = new MyClass();

      // Get the type of MyClass.
      Type myType = typeof(MyClass);

         // Get the field information of MyField.
         FieldInfo myFieldInfo = myType.GetField("MyField", BindingFlags.Public
             | BindingFlags.Instance);

         // Determine whether or not the FieldInfo object is null.
         if (myFieldInfo != null)
            // Get the handle for the field.
            RuntimeFieldHandle myFieldHandle = myFieldInfo.FieldHandle;

            DisplayFieldHandle(outputBlock, myFieldHandle);
            outputBlock.Text += "The myFieldInfo object is null." + "\n";
      catch (Exception e)
         outputBlock.Text += String.Format("Exception: {0}", e.Message) + "\n";

   public static void DisplayFieldHandle(System.Windows.Controls.TextBlock outputBlock, RuntimeFieldHandle myFieldHandle)
      // Get the type from the handle.
      FieldInfo myField = FieldInfo.GetFieldFromHandle(myFieldHandle);

      // Display the type.
      outputBlock.Text += "\nDisplaying the field from the handle.\n" + "\n";
      outputBlock.Text += String.Format("The type is {0}.", myField.ToString()) + "\n";

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2016 Microsoft