GCHandle Structure

GCHandle Structure

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

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

Provides a means for accessing a managed object from unmanaged memory.

Namespace:  System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

No code example is currently available or this language may not be supported.

The GCHandle type exposes the following members.

  NameDescription
Public propertyIsAllocatedGets a value indicating whether the handle is allocated.
Public propertyTargetGets or sets the object this handle represents.
Top

  NameDescription
Public methodAddrOfPinnedObjectSecurity Critical. Retrieves the address of an object in a Pinned handle.
Public methodStatic memberAlloc(Object)Security Critical. Allocates a Normal handle for the specified object.
Public methodStatic memberAlloc(Object, GCHandleType)Security Critical. Allocates a handle of the specified type for the specified object.
Public methodEqualsDetermines whether the specified GCHandle object is equal to the current GCHandle object. (Overrides ValueType::Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodFreeSecurity Critical. Releases a GCHandle.
Public methodStatic memberFromIntPtrSecurity Critical. Returns a new GCHandle object created from a handle to a managed object.
Public methodGetHashCodeReturns an identifier for the current GCHandle object. (Overrides ValueType::GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic memberToIntPtrReturns the internal integer representation of a GCHandle object.
Public methodToStringReturns the fully qualified type name of this instance. (Inherited from ValueType.)
Top

  NameDescription
Public operatorStatic memberExplicit(GCHandle to IntPtr)A GCHandle is stored using an internal integer representation.
Public operatorStatic memberExplicit(IntPtr to GCHandle)Security Critical. A GCHandle is stored using an internal integer representation.
Top

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Show:
© 2017 Microsoft