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

◆ List() [3/3]

System.Collections.Generic.List< T >.List ( IEnumerable< T > collection)
inline

Definition at line 197 of file List.cs.

198 {
199 if (collection == null)
200 {
201 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
202 }
203 if (collection is ICollection<T> { Count: var count } collection2)
204 {
205 if (count == 0)
206 {
208 return;
209 }
210 _items = new T[count];
211 collection2.CopyTo(_items, 0);
212 _size = count;
213 return;
214 }
216 foreach (T item in collection)
217 {
218 Add(item);
219 }
220 }
static readonly T[] s_emptyArray
Definition List.cs:89

References System.Collections.Generic.List< T >._items, System.Collections.Generic.List< T >._size, System.Add, System.collection, System.Collections.Generic.Dictionary< TKey, TValue >.CopyTo(), System.count, System.Collections.Generic.List< T >.Count, System.item, System.Collections.Generic.List< T >.s_emptyArray, and System.ThrowHelper.ThrowArgumentNullException().