Runtime.GetINativeObject Method

Definition

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)

public static ObjCRuntime.INativeObject GetINativeObject (IntPtr ptr, bool owns, Type target_type);
static member GetINativeObject : nativeint * bool * Type -> ObjCRuntime.INativeObject

Parameters

ptr
IntPtr

nativeint

owns
Boolean
target_type
Type

Returns

Applies to

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

T

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).

Applies to