ArrayList Collection C#

ArrayList Collection C#


ArrayList is also a type of a collection. This data structure is also built in C#. ArrayList is just like an array which we use in C++ and c programming language. In ArrayList the data items are stored in consecutive memory locations. To explain ArrayList in C# let us consider the following example. Like all the other data structures ArrayList can be used in a c# program by including the library:

Using System.Collection.Generic;

Note: This library should not only be included in your main() but also in each class associated with your program.

  1. Now make a class of Collection Test.
  2. include System.collection.generic by.

Using System.Collection.Generic;

Now in the CollectionTest{} type the following code:


Now in main() you will make the instance of your class and call the function

s in in the following way:

CollectionTest test=new CollectionTest();

test. testArrayList();


Another Scenario:


Leave a Reply

Your email address will not be published. Required fields are marked *