Pins the specified object to prevent it from being garbage collected or moved. (This called must be matched with a subsequent FreePinnedHandle)
[Visual Basic] Public Shared Function GetPinnedHandle( _ ByVal obj As Object _ ) As Integer [C#] public static int GetPinnedHandle( object obj ); [C++] public: static int GetPinnedHandle( Object* obj ); [JScript] public static function GetPinnedHandle( obj : Object ) : int;
A handle on the pinned object.
Exception Type | Condition |
---|---|
System.Runtime.InteropServices.ArgumentException | if obj is not an array of primitive types. |
System.Runtime.InteropServices.NullReferenceException | if obj is null. |
Marshal Class | Marshal Members | System.Runtime.InteropServices Namespace