示例#1
0
 public void Add(TValue value)
 {
     if (list != null)
     {
         list.Add(value);
         ++count;
     }
     else
     {
         ArrayHelpers.AppendWithCapacity(ref array, ref count, value);
     }
 }
示例#2
0
 public void AppendWithCapacity(TValue value)
 {
     if (length == 0)
     {
         firstValue = value;
     }
     else
     {
         var numAdditionalValues = length - 1;
         ArrayHelpers.AppendWithCapacity(ref additionalValues, ref numAdditionalValues, value);
     }
     ++length;
 }
示例#3
0
        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);
        }