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

◆ InsertRange() [3/3]

ImmutableArray< T > System.Collections.Immutable.ImmutableArray< T >.InsertRange ( int index,
ImmutableArray< T > items )
inline

Definition at line 1090 of file ImmutableArray.cs.

1091 {
1092 ImmutableArray<T> result = this;
1093 result.ThrowNullRefIfNotInitialized();
1094 items.ThrowNullRefIfNotInitialized();
1095 Requires.Range(index >= 0 && index <= result.Length, "index");
1096 if (result.IsEmpty)
1097 {
1098 return items;
1099 }
1100 if (items.IsEmpty)
1101 {
1102 return result;
1103 }
1104 T[] array = new T[result.Length + items.Length];
1105 if (index != 0)
1106 {
1107 Array.Copy(result.array, array, index);
1108 }
1109 if (index != result.Length)
1110 {
1111 Array.Copy(result.array, index, array, index + items.Length, result.Length - index);
1112 }
1113 Array.Copy(items.array, 0, array, index, items.Length);
1114 return new ImmutableArray<T>(array);
1115 }
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, and System.Collections.Immutable.Requires.Range().