NSArray.ArrayFromHandle 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
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
nativeint
Pointer (handle) to the unmanaged object.
Returns
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);
Applies to
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
nativeint
Pointer (handle) to the unmanaged object.
Method that can create objects of type T from a given IntPtr.
Returns
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);