NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

ArrayList.Capacity

Gets or sets the number of elements that the ArrayList can contain.

[Visual Basic]
Overridable Public Property Capacity As Integer
[C#]
public int Capacity {virtual get; virtual set;}
[C++]
public: __property virtual int get_Capacity();
public: __property virtual void set_Capacity(int);
[JScript]
public function get Capacity() : int;
public function set Capacity(int);

Property Value

The number of elements that the ArrayList can contain.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException Capacity is being set to a value that is less than Count.

Remarks

Capacity is the number of elements that the ArrayList is capable of storing. Count is the number of elements that are actually in the ArrayList.

Capacity is always greater than or equal to Count. If Count exceeds Capacity while adding elements, the capacity of the list is doubled by automatically reallocating the internal array.

When the value of Capacity is set explicitly, the internal array is also reallocated to accommodate the specified capacity.

See Also

ArrayList Class | ArrayList Members | System.Collections Namespace | Count