I think I can explain you this with an example
Code:
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ArrayList pm = new ArrayList();
pm.Add(5);
pm.Add(3);
pm.Add(7);
pm.Add(11);
pm.Add(13);
pm.Add(17);
Console.WriteLine("The Count of the Array list = " + pm.Count);
for (int i=0; i<pm.Count; i++)
{
Console.WriteLine(pm[i]);
}
pm.RemoveAt(3);
Console.WriteLine("The Count of the Array list = " + pm.Count);
for (int i = 0; i < pm.Count; i++)
{
Console.WriteLine(pm[i]);
}
Console.ReadLine();
}
}
}
The ‘Add’ method will add a new object in the collection Array list , RemoveAt method removes the particular object at the specified index. And the count method will count the total number of objets in the array list.
Bookmarks