C# C# Console Application

How to count the elements of an ArrayList in C#1 min read

.Net framework ArrayList class implements the IList interface using an array whose size is dynamically increased as required. ArrayList.Count() property allow us to get the number of elements actually contained in the ArrayList. this ArrayList Count property exists in System.Collections namespace.

arraylist Count property return value data type is System.Int32. this integer value represents the number of elements actually contained in the arraylist. this property implements as ICollection.Count. Capacity is always greater than or equal to Count property value. Capacity is the number of elements that the arraylist can store.




the following console c# example code demonstrate us how can we get the number of elements exists in arraylist programmatically at run time in an console application.

C# Code:

 

Output:

 

Leave a Comment