Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Count Property

ArrayList.Count Property

Gets the number of elements actually contained in the ArrayList.

[Visual Basic]
Public Overridable ReadOnly Property Count As Integer  Implements _
public virtual int Count {get;}
public: __property virtual int get_Count();
public function get Count() : int;

Property Value

The number of elements actually contained in the ArrayList.




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

Count is always less than or equal to Capacity. If Count exceeds Capacity while adding elements, the capacity of the list is doubled by automatically reallocating the internal array before copying the old elements and adding the new elements.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

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

© 2015 Microsoft