The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
FieldInfo::FieldHandle Property
.NET Framework (current version)
Gets a RuntimeFieldHandle, which is a handle to the internal metadata representation of a field.
Assembly: mscorlib (in mscorlib.dll)
public: property RuntimeFieldHandle FieldHandle { virtual RuntimeFieldHandle get() abstract; }
Property Value
Type: System::RuntimeFieldHandleA handle to the internal metadata representation of a field.
Implements
_FieldInfo::FieldHandleThe handles are valid only in the appdomain in which they were obtained.
The following example retrieves MyClass.MyField field information and displays the field associated with the field handle.
using namespace System; using namespace System::Reflection; public ref class MyClass { public: String^ MyField; }; void DisplayFieldHandle( RuntimeFieldHandle myFieldHandle ) { // Get the type from the handle. FieldInfo^ myField = FieldInfo::GetFieldFromHandle( myFieldHandle ); // Display the type. Console::WriteLine( "\nDisplaying the field from the handle.\n" ); Console::WriteLine( "The type is {0}.", myField ); } int main() { MyClass^ myClass = gcnew MyClass; // Get the type of MyClass. Type^ myType = MyClass::typeid; try { // Get the field information of MyField. FieldInfo^ myFieldInfo = myType->GetField( "MyField", static_cast<BindingFlags>(BindingFlags::Public | BindingFlags::Instance) ); // Determine whether or not the FieldInfo Object* is 0. if ( myFieldInfo != nullptr ) { // Get the handle for the field. RuntimeFieldHandle myFieldHandle = myFieldInfo->FieldHandle; DisplayFieldHandle( myFieldHandle ); } else { Console::WriteLine( "The myFieldInfo Object* is 0." ); } } catch ( Exception^ e ) { Console::WriteLine( "Exception: {0}", e->Message ); } }
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show: