ArrayList in Visual Basic .NET

The ArrayList is one of the popular date type of the collections that the .NET Framework uses extensively
This ArryList can size dynamically, you do not have to specify the size of the array. It grows dynamically as you add elements to it
Lets see how we create the ArrayList and add elements to it

Code explanation

Line 15: I have created the ArrayList here
Line 17: Add the element to list object

I have created the Student structure from line 23.

Iterating the ArrayList
I am using For…Each loop iterate the ArrayList

Code explanation

Line 2: Using CType to cast the ArrayList object to Student Structure
Line 3: Once You cast the object you can acres it propertiesprperties

Deleting item from ArrayList
To delete item from ArrayList you can use two methods
1 remove() –
You have to pass object as the parameter and it will delete the first occurrence of the object from ArrayList
2 removeAt()
Here you have to pass the index of the item to be deleted