Count Property in ArrayList

In this article I will explain the count property of ArrayList.
  • 2390

We can get the number of elements that actually contained in the ArrayList.

namespace ArrayList1

{

    class Program

    {

        static void Main(string[] args)

        {

            ArrayList ar = new ArrayList();

            ar.Add("Jan");

            ar.Add("Feb");

            ar.Add("March");

            ar.Add("April");

            ar.Add("May");

            ar.Add("June");

            ar.Add("July");

            int a = ar.Count;

            Console.WriteLine("The number of elements in the ArrayList are:" + a);

        }

    }

}

Further Readings

You may also want to read these related articles.

Ask Your Question 

Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.