- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the Count property of ArrayList class in C#?
The Count property in the ArrayList class counts the number of elements in the ArrayList.
Firstly, add elements to the ArrayList −
ArrayList arrList = new ArrayList(); arrList.Add(98); arrList.Add(55); arrList.Add(65); arrList.Add(34);
Then get the count of the array list −
arrList.Count
The following is the code to implement Count property in C# −
Example
using System; using System.Collections; class Demo { public static void Main() { ArrayList arrList = new ArrayList(); arrList.Add(98); arrList.Add(55); arrList.Add(65); arrList.Add(34); Console.WriteLine("Count = " + arrList.Count); } }
Output
Count = 4
Advertisements