Link Search Menu Expand Document

Capacity

The Capacity property is used to used to get or set the number of elements that the internal array can contain. If the size of the array is known ahead of time then setting the capacity may result in a small performance boost when assigning elements; otherwise, the capacity will be set as required when new elements are added.

Note

Similar to the processes in C#’s ArrayList or GoLang’s append, each time the current internal capacity is reached it will be doubled. This should provide a small performance benefit over resizing the array each time a new element is added.


Table of contents