ASP.NET ArrayList
The ArrayList is a versatile collection that provides a straightforward means of managing a list of values. It offers a range of operations such as adding, inserting, deleting, and viewing elements, making it highly convenient for data manipulation.
Add Items
VB.NetThe capacity of an ArrayList refers to the number of elements it can accommodate. As elements are added to an ArrayList, the capacity dynamically expands through automatic reallocation to meet the growing requirements. This automatic capacity adjustment ensures efficient memory allocation and utilization. Conversely, the capacity can be reduced by explicitly calling the TrimToSize method or setting the Capacity property.
Insert items
We can insert items in an ArrayList with a specified index
VB.NetThe ArrayList collection accommodates a wide range of values, including the acceptance of the "Nothing" value as a valid element. Additionally, it allows for the presence of duplicate elements, providing flexibility in managing data with varying degrees of uniqueness. The dynamic nature of the ArrayList is especially advantageous as it allows elements to be added without requiring prior knowledge of the size, enabling the collection to dynamically grow as needed. Furthermore, it also has the capability to shrink in size when required, further enhancing its flexibility and memory efficiency.
Removing items
For removing items from an ArrayList , we can use ArrayList.Remove(object)
VB.NetAn ArrayList can also be sorted alphabetically or numerically with the Sort() method.
VB.NetThe following ASP.NET program add seven days in a week to an ArrayList and bind it to a ListBox control.
Default.aspx