NSArray.FromArray<T>(NSArray) Method

Definition

Creates a strongly-typed C# array from a weakly typed NSArray.

public static T[] FromArray<T>(Foundation.NSArray weakArray) where T : Foundation.NSObject;
public static T[]? FromArray<T>(Foundation.NSArray? weakArray) where T : Foundation.NSObject;
static member FromArray : Foundation.NSArray -> 'T[] (requires 'T :> Foundation.NSObject)

Type Parameters

T

The element type for the returned array, limited to NSObject and subclasses.

Parameters

weakArray
NSArray

A weakly typed NSArray to convert, or null.

Returns

T[]

A C# array of T elements, or null if weakArray is null or a conversion error occurs. Elements that are NSNull or not compatible with T are excluded.

Remarks

NSArray someArray = ...;

var values = NSArray.FromArray<NSString> (someArray);

Applies to