Saturday, April 4, 2015

Array List in c#

an array list is like array but we does not need to specify the size of array list.

ArrayList is a class in collection name space

Some Common Property 


Capacity : Get or set the number of element that ArrayList contain

Count : get the number of element that array list contain

IsFixedSize : Gets a value indicating whether a ArrayList object has a fixed size. A collection with a fixed size does not allow the addition or removal of elements after the collection is created, but does allow the modification of existing elements.

Item : Gets or sets the element at the specified index.

Mothod


Add() : add on object at the end of array list

Example


     ArrayList arr4 = new ArrayList();
            arr4.Add(25);
            arr4.Add(26);
            arr4.Add(36);
            arr4.Add(43);

            foreach (int ok in arr4)
            {
                Console.WriteLine(ok);
            }


            Console.ReadKey();

No comments:

Post a Comment