What is the ArrayList class?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is the ArrayList class?
Rating:
The ArrayList class implements IList interface using an array. The size of an array is dynamically increased or decreased as per the requirements. The two important methods used in the ArrayList class are as follows:
- Add(): It adds an object to the end of the ArrayList.
- Remove(): It removes an object from the ArrayList.
using System;
using System.Collections;
public class MyArrayListClass
{
public static void Main()
{
ArrayList MyArray = new ArrayList();
MyArray.Add("Microsoft");
MyArray.Add("Corporation");
MyArray.Add("Limited");
PrintTheValues(MyArray);
}
public static void PrintTheValues(IEnumerable MyList)
{
foreach(Object list in myList)
Console.Write(list);
}
}
Rating:
Was this information helpful?
Other articles
- What is theIClassFactory interface?
- How to use the UTF8Encoding class to encode and decode a text?
- What is the use of the virtual keyword?
- How to change the Configuration property of a C# .NET project?
- What are the types of Breakingpoints?
