Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Insert() [5/6]

ImmutableArray< T > System.Collections.Immutable.ImmutableArray< T >.Insert ( int index,
T item )
inline

Implements System.Collections.Immutable.IImmutableList< T >.

Definition at line 1033 of file ImmutableArray.cs.

1034 {
1036 immutableArray.ThrowNullRefIfNotInitialized();
1037 Requires.Range(index >= 0 && index <= immutableArray.Length, "index");
1038 if (immutableArray.Length == 0)
1039 {
1040 return ImmutableArray.Create(item);
1041 }
1042 T[] array = new T[immutableArray.Length + 1];
1043 array[index] = item;
1044 if (index != 0)
1045 {
1047 }
1048 if (index != immutableArray.Length)
1049 {
1050 Array.Copy(immutableArray.array, index, array, index + 1, immutableArray.Length - index);
1051 }
1052 return new ImmutableArray<T>(array);
1053 }
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624

References System.Collections.Immutable.ImmutableArray< T >.array, System.Array.Copy(), System.index, System.item, and System.Collections.Immutable.Requires.Range().