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

◆ ToArray< T >() [1/5]

static T[] System.Collections.Generic.EnumerableHelpers.ToArray< T > ( IEnumerable< T > source)
inlinestaticpackage

Definition at line 72 of file EnumerableHelpers.cs.

73 {
74 if (source is ICollection<T> { Count: var count } collection)
75 {
76 if (count == 0)
77 {
78 return Array.Empty<T>();
79 }
80 T[] array = new T[count];
81 collection.CopyTo(array, 0);
82 return array;
83 }
84 LargeArrayBuilder<T> largeArrayBuilder = new LargeArrayBuilder<T>(initialize: true);
85 largeArrayBuilder.AddRange(source);
86 return largeArrayBuilder.ToArray();
87 }

References System.Collections.Generic.Dictionary< TKey, TValue >.AddRange(), System.array, System.collection, System.Array.CopyTo(), System.count, and System.source.