public int Capacity { get; set; }
Public Property Capacity As Integer
Get
Set
public:
property int Capacity {
int get ();
void set (int value);
}
member Capacity : int with get, set
Capacity is the number of elements that the CircularListT can store before resizing is required, whereas Count is the number of elements that are actually in the CircularListT.
Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity is increased by automatically reallocating the internal array before copying the old elements and adding the new elements.
If the capacity is significantly larger than the count and you want to reduce the memory used by the CircularListT, you can decrease capacity by calling the TrimExcess method or by setting the Capacity property explicitly. When the value of Capacity is set explicitly, the internal array is also reallocated to accommodate the specified capacity, and all the elements are copied.
Retrieving the value of this property is an O(1) operation; setting the property is an O(n) operation, where n is the number of stored elements.
ArgumentOutOfRangeException | Capacity is set to a value that is less than Count. |