Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CollectionHelpers.cs
Go to the documentation of this file.
2
3namespace System.Collections;
4
5internal static class CollectionHelpers
6{
7 internal static void ValidateCopyToArguments(int sourceCount, Array array, int index)
8 {
9 if (array == null)
10 {
11 throw new ArgumentNullException("array");
12 }
13 if (array.Rank != 1)
14 {
16 }
17 if (array.GetLowerBound(0) != 0)
18 {
20 }
21 if (index < 0 || index > array.Length)
22 {
24 }
25 if (array.Length - index < sourceCount)
26 {
28 }
29 }
30
31 internal static void CopyTo<T>(ICollection<T> collection, Array array, int index)
32 {
35 {
37 return;
38 }
39 if (array is T[] array2)
40 {
42 return;
43 }
44 if (!(array is object[] array3))
45 {
47 }
48 try
49 {
50 foreach (T item in collection)
51 {
52 array3[index++] = item;
53 }
54 }
56 {
58 }
59 }
60}
static void CopyTo< T >(ICollection< T > collection, Array array, int index)
static void ValidateCopyToArguments(int sourceCount, Array array, int index)
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
static string Arg_ArrayPlusOffTooSmall
Definition SR.cs:16
static string Argument_InvalidArrayType
Definition SR.cs:54
static string Arg_NonZeroLowerBound
Definition SR.cs:14
static string Arg_RankMultiDimNotSupported
Definition SR.cs:18
static string ArgumentOutOfRange_NeedNonNegNum
Definition SR.cs:32
Definition SR.cs:7