NSArray.ArrayFromHandle Method

Definition

Overloads

ArrayFromHandle<T>(IntPtr)

Returns a strongly-typed C# array of the parametrized type from a handle to an NSArray.

ArrayFromHandle<T>(IntPtr, Converter<IntPtr,T>)

Returns a strongly-typed C# array of the parametrized type from a handle to an NSArray.

ArrayFromHandle<T>(IntPtr)

Returns a strongly-typed C# array of the parametrized type from a handle to an NSArray.

public static T[] ArrayFromHandle<T> (IntPtr handle) where T : class, ObjCRuntime.INativeObject;
static member ArrayFromHandle : nativeint -> 'T[] (requires 'T : null and 'T :> ObjCRuntime.INativeObject)

Type Parameters

T

Parameter type, determines the kind of array returned.

Parameters

handle
IntPtr

Pointer (handle) to the unmanaged object.

Returns

T[]

An C# array with the values.

Remarks

Use this method to get a set of NSObject arrays from a handle to an NSArray


IntPtr someHandle = ...;

NSString [] values = NSArray.ArrayFromHandle<NSString> (someHandle);

ArrayFromHandle<T>(IntPtr, Converter<IntPtr,T>)

Returns a strongly-typed C# array of the parametrized type from a handle to an NSArray.

public static T[] ArrayFromHandle<T> (IntPtr handle, Converter<IntPtr,T> creator);
static member ArrayFromHandle : nativeint * Converter<nativeint, 'T> -> 'T[]

Type Parameters

T

Parameter type, determines the kind of array returned.

Parameters

handle
IntPtr

Pointer (handle) to the unmanaged object.

creator
Converter<IntPtr,T>

Method that can create objects of type T from a given IntPtr.

Returns

T[]

An C# array with the values.

Remarks

Use this method to get a set of NSObject arrays from a handle to an NSArray. Instead of wrapping the results in NSObjects, the code invokes your method to create the return value.


int myCreator (IntPtr v)
{
	return (int) v;
}

int [] args = NSArray.ArrayFromHandle<int> (someHandle, myCreator);

Applies to