3 internal struct ArrayBuilder<
T>
5 private const int DefaultCapacity = 4;
7 private const int MaxCoreClrArrayLength = 2146435071;
26 public int Count => _count;
28 public T this[
int index]
36 _array[index] = value;
40 public ArrayBuilder(
int capacity)
42 this =
default(ArrayBuilder<T>);
45 _array =
new T[capacity];
49 public void Add(
T item)
51 if (_count == Capacity)
53 EnsureCapacity(_count + 1);
65 return _array[_count - 1];
75 if (_count < array.Length)
77 array =
new T[_count];
83 public void UncheckedAdd(
T item)
85 _array[_count++] = item;
88 private void EnsureCapacity(
int minimum)
90 int capacity = Capacity;
91 int num = (capacity == 0) ? 4 : (2 * capacity);
92 if ((uint)num > 2146435071u)
94 num =
Math.
Max(capacity + 1, 2146435071);
97 T[] array =
new T[num];
static sbyte Max(sbyte val1, sbyte val2)
Returns the larger of two 8-bit signed integers.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
The Add key (the addition key on the numeric keypad).
static void Copy(Array sourceArray, Array destinationArray, int length)
Copies a range of elements from an T:System.Array starting at the first element and pastes them into ...
Provides constants and static methods for trigonometric, logarithmic, and other common mathematical f...