NSObject.InitializeHandle 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
| Name | Description |
|---|---|
| InitializeHandle(NativeHandle) | |
| InitializeHandle(NativeHandle, String) | |
| InitializeHandle(NativeHandle, String, Boolean) |
Initializes the Handle property with the result of a native initializer. |
InitializeHandle(NativeHandle)
protected void InitializeHandle(ObjCRuntime.NativeHandle handle);
member this.InitializeHandle : ObjCRuntime.NativeHandle -> unit
Parameters
- handle
- NativeHandle
Applies to
InitializeHandle(NativeHandle, String)
protected void InitializeHandle(ObjCRuntime.NativeHandle handle, string initSelector);
member this.InitializeHandle : ObjCRuntime.NativeHandle * string -> unit
Parameters
- handle
- NativeHandle
- initSelector
- String
Applies to
InitializeHandle(NativeHandle, String, Boolean)
Initializes the Handle property with the result of a native initializer.
protected internal void InitializeHandle(ObjCRuntime.NativeHandle handle, string initSelector, bool throwOnInitFailure);
member this.InitializeHandle : ObjCRuntime.NativeHandle * string * bool -> unit
Parameters
- handle
- NativeHandle
The handle returned by the native initializer.
- initSelector
- String
The selector of the native initializer that produced handle. Only used in the exception message when initialization fails.
- throwOnInitFailure
- Boolean
If true, an exception is thrown when the native initializer failed (returned nil); if false, the Handle property is set to the (possibly null) handle without throwing.
Remarks
Pass false for throwOnInitFailure to implement a factory method for a failable initializer: this makes it possible to detect a nil result (by checking the Handle property) and return null instead of throwing. This is what the generator does for constructors annotated with [FactoryMethod].