Επεξεργασία

Κοινή χρήση μέσω


GCHandle.AddrOfPinnedObject Method

Definition

Retrieves the address of object data in a Pinned handle.

public:
 IntPtr AddrOfPinnedObject();
[System.Security.SecurityCritical]
public IntPtr AddrOfPinnedObject ();
public IntPtr AddrOfPinnedObject ();
public readonly IntPtr AddrOfPinnedObject ();
[<System.Security.SecurityCritical>]
member this.AddrOfPinnedObject : unit -> nativeint
member this.AddrOfPinnedObject : unit -> nativeint
Public Function AddrOfPinnedObject () As IntPtr

Returns

IntPtr

nativeint

The address of the pinned data object.

Attributes

Exceptions

The handle is any type other than Pinned.

Remarks

This method is used to get a stable pointer to the object data. For arrays, this method returns the address of the first element. For strings, this method returns the address of the first character.

Pinning an object prevents the garbage collector from moving it around in memory, thereby reducing the efficiency of the garbage collector.

Applies to

See also