/// <summary> /// Copies buffer contents to an array. /// </summary> /// <param name="array">The array to which the buffer items must be copied.</param> /// <param name="arrayIndex">The array index where the first buffered item is to be inserted.</param> /// <seealso cref="ICollection.CopyTo"/> public void CopyTo(T[] array, TSize arrayIndex) { for (BufferSegment node = _firstSegment; node != null; node = node.NextSegment) { node.CopyTo(array, arrayIndex); Size.AddWith(ref arrayIndex, node.Count); } }