ArrayList Class In C Sharp


ArrayList
•In C# standard arrays are of fixed length array, which cannot be changed during program execution. We must have to know in advance that how many elements an array will hold.
•With the help of  ArrrayList class we can create dynamic array which can grow and shrink as required. An ArrayList is a variable length array. When size is exceeded, the collection is automatically enlarged. When objects are removed, the array can be shrunk.
•The ArrayList class is very useful if you are working with arrays and need to add, remove, index, or search for data in a collection.
•ArrayList implements ICollection, IList, IEnumerable and ICloneable.
•ArrayList class belongs to System.Collections namespace

----------------------------------------------------------------------------------------------------------
ArrayList Constructors is given below:-

1) public ArrayList( )  :-    
Create an empty ArrayList with an initial capacity of zero.

2) public ArrayList(ICollection c)  :-  
Create an ArrayList that is initialized with the elements specified by c and has an initial capacity equal to the number of elements.

3) public ArrayList(int capacity)  :-
Create an array list that has the specified initial capacity. The capacity is the size of the underlying array that is used to store the elements. The capacity grows automatically as elements are added to an ArrayList.


ArrayList Class In C Sharp ArrayList Class In C Sharp Reviewed by Baljeet Singh on 09:51 Rating: 5

No comments:

Powered by Blogger.