NSArray.ArrayFromHandleFunc 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 |
|---|---|
| ArrayFromHandleFunc<T>(NativeHandle, Func<NativeHandle,T>) |
Creates a strongly-typed C# array from a handle to an NSArray, using a custom factory function. |
| ArrayFromHandleFunc<T>(NativeHandle, Func<NativeHandle,T>, Boolean) |
Creates a strongly-typed C# array from a handle to an NSArray, using a custom factory function. |
ArrayFromHandleFunc<T>(NativeHandle, Func<NativeHandle,T>)
Creates a strongly-typed C# array from a handle to an NSArray, using a custom factory function.
public static T[] ArrayFromHandleFunc<T>(ObjCRuntime.NativeHandle handle, Func<ObjCRuntime.NativeHandle,T> createObject);
public static T?[]? ArrayFromHandleFunc<T>(ObjCRuntime.NativeHandle handle, Func<ObjCRuntime.NativeHandle,T> createObject);
static member ArrayFromHandleFunc : ObjCRuntime.NativeHandle * Func<ObjCRuntime.NativeHandle, 'T> -> 'T[]
Type Parameters
- T
The element type for the returned array.
Parameters
- handle
- NativeHandle
Pointer (handle) to the unmanaged NSArray object.
- createObject
- Func<NativeHandle,T>
A factory function that creates an instance of T from a native handle.
Returns
A C# array with the values, or null if handle is Zero.
Remarks
Instead of wrapping the results in NSObject instances, this method invokes createObject for each element to create the return value.
var args = NSArray.ArrayFromHandleFunc<int> (someHandle, (x) => (int) x);
Applies to
ArrayFromHandleFunc<T>(NativeHandle, Func<NativeHandle,T>, Boolean)
Creates a strongly-typed C# array from a handle to an NSArray, using a custom factory function.
public static T[] ArrayFromHandleFunc<T>(ObjCRuntime.NativeHandle handle, Func<ObjCRuntime.NativeHandle,T> createObject, bool releaseHandle);
public static T?[]? ArrayFromHandleFunc<T>(ObjCRuntime.NativeHandle handle, Func<ObjCRuntime.NativeHandle,T> createObject, bool releaseHandle);
static member ArrayFromHandleFunc : ObjCRuntime.NativeHandle * Func<ObjCRuntime.NativeHandle, 'T> * bool -> 'T[]
Type Parameters
- T
The element type for the returned array.
Parameters
- handle
- NativeHandle
Pointer (handle) to the unmanaged NSArray object.
- createObject
- Func<NativeHandle,T>
A factory function that creates an instance of T from a native handle.
- releaseHandle
- Boolean
Whether the native NSArray instance should be released before returning or not.
Returns
A C# array with the values, or null if handle is Zero.