Runtime.GetNSObjectChecked<T>(IntPtr) 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.
public static T? GetNSObjectChecked<T>(IntPtr ptr) where T : Foundation.NSObject;
static member GetNSObjectChecked : nativeint -> 'T (requires 'T :> Foundation.NSObject)
Type Parameters
- T
Type to wrap the native object as.
Parameters
- ptr
-
IntPtr
nativeint
A pointer to an unmanaged NSObject or any class that derives from the Objective-C NSObject class.
Returns
An instance of the class T.
Remarks
Contrary to GetNSObject<T>(IntPtr), this method will throw an exception if the native object's type is not compatible with T.
This method will fail if there already is a managed wrapper of a different and incompatible type for the native object.