using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ArrayList arr = new ArrayList();
arr.Add("Uday");
arr.Add("Vijay");
Console.WriteLine("The count in the arraylist is " + arr.Count);
arr.Add("Shiva");
arr.Add("Raju");
// Whenever we add Five Element the Capacity will be double, the default capacity of
//ArrayList is 4
Console.WriteLine("the capacity in the arraylist is " + arr.Capacity);
arr.Add("Srikanth");
Console.WriteLine("the capacity in th arraylist is " + arr.Capacity);
arr.Add("Srinu");
arr.Add("Trisha");
arr.Add("Illeana");
arr.Add("Samantha");
Console.WriteLine("the capacity in th arraylist is " + arr.Capacity);
arr.Add("Chiranjeevi");
arr.Add("Prasad");
arr.Add("Venkatesh");
arr.Add("Murthy");
arr.Add("Charan");
arr.Add("Mahesh");
arr.Add("Pawan");
Console.WriteLine("The capacity in th arraylist is " + arr.Capacity);
arr.Add("AlluArjun");
Console.WriteLine("the capacity in th arraylist is " + arr.Capacity);
Console.ReadKey();
}
}
}
Output
Count:
It is used to count the total no of elements which are been inserted.
Output:
Count: It is used to Count the Total no of elements which are inserted.
Contains: It is used to check wheather the element exists in the ArrayList or Not.
Output:
Insert Method;
It will insert the element in the specified location of the index in the ArrayList.
AddRange
It will add the collections of elements in the object as individual objects in the Array List
Output:
RemoveAt
It will remove the object as specified in the argument.
Output
No comments:
Post a Comment
Thank you for visiting my blog