Addr OfPinned Object Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves the address of object data in a Pinned handle.
public: IntPtr AddrOfPinnedObject();
[System.Security.SecurityCritical] public IntPtr AddrOfPinnedObject ();
public IntPtr AddrOfPinnedObject ();
[<System.Security.SecurityCritical>] member this.AddrOfPinnedObject : unit -> nativeint
member this.AddrOfPinnedObject : unit -> nativeint
Public Function AddrOfPinnedObject () As IntPtr
The address of the pinned data object.
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.