Runtime.GetINativeObject Method
Definition
Important
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.
Overloads
GetINativeObject(IntPtr, Boolean, Type) | |
GetINativeObject<T>(IntPtr, Boolean) |
Wraps an native IntPtr with a managed object of the specified type. |
GetINativeObject(IntPtr, Boolean, Type)
GetINativeObject<T>(IntPtr, Boolean)
Wraps an native IntPtr with a managed object of the specified type.
public static T GetINativeObject<T> (IntPtr ptr, bool owns) where T : class, ObjCRuntime.INativeObject;
static member GetINativeObject : nativeint * bool -> 'T (requires 'T : null and 'T :> ObjCRuntime.INativeObject)
Type Parameters
- T
The type of the object to return. This can also be an interface corresponding to an Objective-C protocol.
Parameters
- ptr
-
IntPtr
nativeint
A pointer to a native object.
- owns
- Boolean
Pass true if the caller has a reference to the native object, and wants to give it to the managed wrapper instance. Otherwise pass false (and the native object will be retained).
Returns
An instance of a class implementing the specified type.
Remarks
Returns an instance of the specified type even if the native object is not in the class hierarchy of type (there are no type checks).