Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ArrayBuilder.cs
Go to the documentation of this file.
2
4
5[DefaultMember("Item")]
6internal struct ArrayBuilder<T>
7{
8 private T[] _array;
9
10 private int _count;
11
13 {
14 this = default(System.Collections.Generic.ArrayBuilder<T>);
15 if (capacity > 0)
16 {
17 _array = new T[capacity];
18 }
19 }
20
21 public T[] ToArray()
22 {
23 if (_count == 0)
24 {
25 return Array.Empty<T>();
26 }
27 T[] array = _array;
28 if (_count < array.Length)
29 {
30 array = new T[_count];
32 }
33 return array;
34 }
35
36 public void UncheckedAdd(T item)
37 {
38 _array[_count++] = item;
39 }
40}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624