This documentation is archived and is not being maintained.

GCHandle.AddrOfPinnedObject Method

Retrieves the address of an object in a Pinned handle.

[Visual Basic]
Public Function AddrOfPinnedObject() As IntPtr
[C#]
public IntPtr AddrOfPinnedObject();
[C++]
public: IntPtr AddrOfPinnedObject();
[JScript]
public function AddrOfPinnedObject() : IntPtr;

Return Value

The address of the of the Pinned object as an IntPtr.

Exceptions

Exception Type Condition
InvalidOperationException The handle is any type other than Pinned.

Remarks

This method is used to get a stable pointer to the object. Pinning an object prevents the garbage collector from moving it around in memory, thereby reducing the efficiency of the garbage collector.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

.NET Framework Security: 

See Also

GCHandle Structure | GCHandle Members | System.Runtime.InteropServices Namespace | GCHandleType

Show: