Version 2.1.0.0

ArrayUtilities class

Namespace: Sirenix.Utilities
Assembly: Sirenix.Utilities
public static class ArrayUtilities
Contains utilities for operating on arrays.
Inheritance
  • System.Object
  • ArrayUtilities

Methods

CreateNewArrayWithAddedElement<T>(T[], T)
Creates a new array with an added element.
public static T[] CreateNewArrayWithAddedElement<T>(T[] array, T value)
Parameters
T[] array

The array.

T value

The value to add.

Returns
T[]

The new array.

Type Parameters
T

The element type of the array.

Exceptions
System.ArgumentNullException

The given array was null.

CreateNewArrayWithInsertedElement<T>(T[], Int32, T)
Creates a new array with an element inserted at a given index.
public static T[] CreateNewArrayWithInsertedElement<T>(T[] array, int index, T value)
Parameters
T[] array

The array.

System.Int32 index

The index to insert at.

T value

The value to insert.

Returns
T[]

Type Parameters
T

The element type of the array.

Exceptions
System.ArgumentNullException

The given array was null.

System.ArgumentOutOfRangeException

The index to insert at was out of range.

CreateNewArrayWithRemovedElement<T>(T[], Int32)
Creates a new array with an element removed.
public static T[] CreateNewArrayWithRemovedElement<T>(T[] array, int index)
Parameters
T[] array

The array.

System.Int32 index

The index to remove an element at.

Returns
T[]

Type Parameters
T

The element type of the array.

Exceptions
System.ArgumentNullException

The given array was null.

System.ArgumentOutOfRangeException

The given index to remove an element at was out of range.