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.
The following code snippet displays the use of the ArrayList class:

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:



Other articles

Click here to Article home

Microsoft Certification MCSE: MCSA , MCTS, MCDST, MCAD, MCDBA, MCSE Messaging, MCSE Security
JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.
 
HACKER SAFE certified sites prevent over 99.9% of hacker crime.