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

◆ Sort() [4/4]

ImmutableArray< T > System.Collections.Immutable.ImmutableArray< T >.Sort ( int index,
int count,
IComparer< T >? comparer )
inline

Definition at line 1299 of file ImmutableArray.cs.

1300 {
1301 ImmutableArray<T> result = this;
1302 result.ThrowNullRefIfNotInitialized();
1303 Requires.Range(index >= 0, "index");
1304 Requires.Range(count >= 0 && index + count <= result.Length, "count");
1305 if (count > 1)
1306 {
1307 if (comparer == null)
1308 {
1309 comparer = Comparer<T>.Default;
1310 }
1311 bool flag = false;
1312 for (int i = index + 1; i < index + count; i++)
1313 {
1314 if (comparer.Compare(result.array[i - 1], result.array[i]) > 0)
1315 {
1316 flag = true;
1317 break;
1318 }
1319 }
1320 if (flag)
1321 {
1322 T[] array = new T[result.Length];
1323 Array.Copy(result.array, array, result.Length);
1325 return new ImmutableArray<T>(array);
1326 }
1327 }
1328 return result;
1329 }
static void Sort(Array array)
Definition Array.cs:2329
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624

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