public void Add(TValue value) { if (list != null) { list.Add(value); ++count; } else { ArrayHelpers.AppendWithCapacity(ref array, ref count, value); } }
public void AppendWithCapacity(TValue value) { if (length == 0) { firstValue = value; } else { var numAdditionalValues = length - 1; ArrayHelpers.AppendWithCapacity(ref additionalValues, ref numAdditionalValues, value); } ++length; }
public int AppendWithCapacity(TValue value, int capacityIncrement = 10) { if (length == 0) { firstValue = value; } else { var numAdditionalValues = length - 1; ArrayHelpers.AppendWithCapacity(ref additionalValues, ref numAdditionalValues, value, capacityIncrement: capacityIncrement); } var index = length; ++length; return(index); }