Partager via


ArrayList.Capacity Property

Gets or sets the number of objects that the ArrayList collection can contain.

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)

Syntax

public virtual int Capacity { get; set; }

Property Value

The maximum number of objects that the ArrayList collection can contain.

Remarks

The Capacity property denotes the maximum number of objects that the ArrayList collection is capable of storing. The Count property denotes the number of objects that the ArrayList collection actually contains. By definition, the value of Capacity is always greater than or equal to the value of Count. If the Count value surpasses the Capacity value while objects are being added to the collection, the capacity of the collection is automatically doubled.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

ArrayList Class
ArrayList Members
System.Collections Namespace