Arraylist properties and methods in C#

ArrayList alphaList = new ArrayList(); 
alphaList.Add("A"); 
alphaList.Add("D"); 
alphaList.Add("W"); 
Console.WriteLine("Original Capacity"); 
Console.WriteLine(alphaList.Capacity); 
Console.WriteLine("Original Values"); 
foreach (object alpha in alphaList) 
{ 
	Console.WriteLine(alpha); 
} 
 
alphaList.Insert(alphaList.IndexOf("D") , "C"); 
alphaList.Insert(alphaList.IndexOf("W") , "J"); 
Console.WriteLine("New Capacity"); 
Console.WriteLine(alphaList. Capacity); 
Console.WriteLine("New Values"); 
foreach (object alpha in alphaList) 
{ 
	Console.WriteLine(alpha); 
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.