You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Foundation] Improve nullability in NSArray.ArrayFromHandleFunc. (#24900)
* Improve nullability annotations for ArrayFromHandleFunc<T> (return T?[]?).
* Add an ArrayFromHandleDropNullElements overload with Converter and NSNullBehavior parameters.
* Update DictionaryContainer.GetArray and GetArrayOfDictionariesValue to use ArrayFromHandleDropNullElements.
* Update NSUrlSessionConfiguration.ProxyConfigurations to use NonNullArrayFromHandleDropNullElements.
* Update PdfAnnotation.QuadrilateralPoints to return CGPoint[]? and use ArrayFromHandle.
* Update XML docs for ArrayFromHandleFunc, ProxyConfigurations and QuadrilateralPoints.
Contributes towards #17285.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
/// <summary>Returns a strongly-typed C# array from a handle to an NSArray, dropping null elements.</summary>
690
+
/// <typeparam name="T">Parameter type, determines the kind of array returned.</typeparam>
691
+
/// <param name="handle">Pointer (handle) to the unmanaged object.</param>
692
+
/// <param name="createObject">A delegate to convert a native handle to an object of type T.</param>
693
+
/// <param name="nsNullElementBehavior">How to handle null and NSNull elements in the native array.</param>
694
+
/// <param name="releaseHandle">Whether the native NSArray instance should be released before returning or not.</param>
695
+
/// <returns>A C# array with the values (excluding null elements). Returns <see langword="null" /> if the handle is <see cref="NativeHandle.Zero" />.</returns>
/// <typeparam name="T">Parameter type, determines the kind of array returned.</typeparam>
838
-
/// <param name="handle">Pointer (handle) to the unmanaged object.</param>
839
-
/// <param name="createObject">To be added.</param>
840
-
/// <summary>Returns a strongly-typed C# array of the parametrized type from a handle to an NSArray.</summary>
841
-
/// <returns>An C# array with the values.</returns>
847
+
/// <summary>Creates a strongly-typed C# array from a handle to an <see cref="NSArray" />, using a custom factory function.</summary>
848
+
/// <typeparam name="T">The element type for the returned array.</typeparam>
849
+
/// <param name="handle">Pointer (handle) to the unmanaged <see cref="NSArray" /> object.</param>
850
+
/// <param name="createObject">A factory function that creates an instance of <typeparamref name="T" /> from a native handle.</param>
851
+
/// <returns>A C# array with the values, or <see langword="null" /> if <paramref name="handle" /> is <see cref="NativeHandle.Zero" />.</returns>
842
852
/// <remarks>
843
-
/// <para>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.</para>
0 commit comments