Show / Hide Table of Contents

Method ExtMisc.InsertAt(+ 1 overload)


Overload

Creates a copy of this array with one inserted element.

public static T[] InsertAt<T>(this T[] t, int index, T value = default)
Parameters
t  (T[])
index  (int)

Where to insert. If -1, adds to the end.

value  (T)
Returns
T[]
Exceptions
ArgumentOutOfRangeException
Type Parameters
T

Overload(top)

Creates a copy of this array with several inserted elements.

public static T[] InsertAt<T>(this T[] t, int index, params ReadOnlySpan<T> values)
Parameters
t  (T[])
index  (int)

Where to insert. If -1, adds to the end.

values  (ReadOnlySpan<T>)
Returns
T[]
Exceptions
ArgumentOutOfRangeException
Type Parameters
T