|
@@ -36,6 +36,9 @@ namespace Godot.Collections
|
|
|
/// <summary>
|
|
|
/// Constructs a new <see cref="Array"/> from the given collection's elements.
|
|
|
/// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="collection"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
/// <param name="collection">The collection of elements to construct from.</param>
|
|
|
/// <returns>A new Godot Array.</returns>
|
|
|
public Array(IEnumerable<Variant> collection) : this()
|
|
@@ -50,6 +53,9 @@ namespace Godot.Collections
|
|
|
/// <summary>
|
|
|
/// Constructs a new <see cref="Array"/> from the given objects.
|
|
|
/// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="array"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
/// <param name="array">The objects to put in the new array.</param>
|
|
|
/// <returns>A new Godot Array.</returns>
|
|
|
public Array(Variant[] array)
|
|
@@ -68,6 +74,13 @@ namespace Godot.Collections
|
|
|
this[i] = array[i];
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Constructs a new <see cref="Array"/> from the given span's elements.
|
|
|
+ /// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="array"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
+ /// <returns>A new Godot Array.</returns>
|
|
|
public Array(Span<StringName> array)
|
|
|
{
|
|
|
if (array == null)
|
|
@@ -84,6 +97,13 @@ namespace Godot.Collections
|
|
|
this[i] = array[i];
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Constructs a new <see cref="Array"/> from the given span's elements.
|
|
|
+ /// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="array"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
+ /// <returns>A new Godot Array.</returns>
|
|
|
public Array(Span<NodePath> array)
|
|
|
{
|
|
|
if (array == null)
|
|
@@ -100,6 +120,13 @@ namespace Godot.Collections
|
|
|
this[i] = array[i];
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Constructs a new <see cref="Array"/> from the given span's elements.
|
|
|
+ /// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="array"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
+ /// <returns>A new Godot Array.</returns>
|
|
|
public Array(Span<Rid> array)
|
|
|
{
|
|
|
if (array == null)
|
|
@@ -121,6 +148,13 @@ namespace Godot.Collections
|
|
|
// fine as long as the array is not mutated. However, Span does this type checking at
|
|
|
// instantiation, so it's not possible to use it even when not mutating anything.
|
|
|
// ReSharper disable once RedundantNameQualifier
|
|
|
+ /// <summary>
|
|
|
+ /// Constructs a new <see cref="Array"/> from the given ReadOnlySpan's elements.
|
|
|
+ /// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="array"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
+ /// <returns>A new Godot Array.</returns>
|
|
|
public Array(ReadOnlySpan<GodotObject> array)
|
|
|
{
|
|
|
if (array == null)
|
|
@@ -861,9 +895,15 @@ namespace Godot.Collections
|
|
|
/// Copies the elements of this <see cref="Array"/> to the given
|
|
|
/// <see cref="Variant"/> C# array, starting at the given index.
|
|
|
/// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="array"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
/// <exception cref="ArgumentOutOfRangeException">
|
|
|
/// <paramref name="arrayIndex"/> is less than 0 or greater than the array's size.
|
|
|
/// </exception>
|
|
|
+ /// <exception cref="ArgumentException">
|
|
|
+ /// The destination array was not long enough.
|
|
|
+ /// </exception>
|
|
|
/// <param name="array">The array to copy to.</param>
|
|
|
/// <param name="arrayIndex">The index to start at.</param>
|
|
|
public void CopyTo(Variant[] array, int arrayIndex)
|
|
@@ -1031,6 +1071,7 @@ namespace Godot.Collections
|
|
|
/// <summary>
|
|
|
/// Constructs a new empty <see cref="Array{T}"/>.
|
|
|
/// </summary>
|
|
|
+ /// <returns>A new Godot Array.</returns>
|
|
|
public Array()
|
|
|
{
|
|
|
_underlyingArray = new Array();
|
|
@@ -1039,6 +1080,9 @@ namespace Godot.Collections
|
|
|
/// <summary>
|
|
|
/// Constructs a new <see cref="Array{T}"/> from the given collection's elements.
|
|
|
/// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="collection"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
/// <param name="collection">The collection of elements to construct from.</param>
|
|
|
/// <returns>A new Godot Array.</returns>
|
|
|
public Array(IEnumerable<T> collection)
|
|
@@ -1055,6 +1099,9 @@ namespace Godot.Collections
|
|
|
/// <summary>
|
|
|
/// Constructs a new <see cref="Array{T}"/> from the given items.
|
|
|
/// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="array"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
/// <param name="array">The items to put in the new array.</param>
|
|
|
/// <returns>A new Godot Array.</returns>
|
|
|
public Array(T[] array)
|
|
@@ -1071,9 +1118,16 @@ namespace Godot.Collections
|
|
|
/// <summary>
|
|
|
/// Constructs a typed <see cref="Array{T}"/> from an untyped <see cref="Array"/>.
|
|
|
/// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="array"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
/// <param name="array">The untyped array to construct from.</param>
|
|
|
+ /// <returns>A new Godot Array.</returns>
|
|
|
public Array(Array array)
|
|
|
{
|
|
|
+ if (array == null)
|
|
|
+ throw new ArgumentNullException(nameof(array));
|
|
|
+
|
|
|
_underlyingArray = array;
|
|
|
}
|
|
|
|
|
@@ -1085,6 +1139,7 @@ namespace Godot.Collections
|
|
|
/// Converts this typed <see cref="Array{T}"/> to an untyped <see cref="Array"/>.
|
|
|
/// </summary>
|
|
|
/// <param name="from">The typed array to convert.</param>
|
|
|
+ /// <returns>A new Godot Array, or <see langword="null"/> if <see paramref="from"/> was null.</returns>
|
|
|
public static explicit operator Array(Array<T> from)
|
|
|
{
|
|
|
return from?._underlyingArray;
|
|
@@ -1695,9 +1750,15 @@ namespace Godot.Collections
|
|
|
/// Copies the elements of this <see cref="Array{T}"/> to the given
|
|
|
/// C# array, starting at the given index.
|
|
|
/// </summary>
|
|
|
+ /// <exception cref="ArgumentNullException">
|
|
|
+ /// The <paramref name="array"/> is <see langword="null"/>.
|
|
|
+ /// </exception>
|
|
|
/// <exception cref="ArgumentOutOfRangeException">
|
|
|
/// <paramref name="arrayIndex"/> is less than 0 or greater than the array's size.
|
|
|
/// </exception>
|
|
|
+ /// <exception cref="ArgumentException">
|
|
|
+ /// The destination array was not long enough.
|
|
|
+ /// </exception>
|
|
|
/// <param name="array">The C# array to copy to.</param>
|
|
|
/// <param name="arrayIndex">The index to start at.</param>
|
|
|
public void CopyTo(T[] array, int arrayIndex)
|