Name
RemoveAt
Synopsis
Application.RemoveAt(ByVal index As Integer)
Removes an item from the Application collection by index. This is a new companion to the Remove method, which removes an item by key.
Parameters
-
index
An Integer argument containing the index location of the item to remove from the Application collection.
Example
Sub Page_Load( ) If Application.Count > 0 Then Application.RemoveAt(0) Message.Text = "The item at index 0 was removed." Else Message.Text = "The item at index 0 does not exist." End If End Sub
Notes
The RemoveAt method allows items to be removed from the Application collection by index rather than by key. As in the example above, the items that follow the removed item will shift one position in the collection when the item is removed. If you remove an item by index and then call RemoveAt again with the same index, you will remove the item that immediately followed the original removed item. If a single item is in the Application collection and you call RemoveAt a second time, an ArgumentOutOfRangeException exception will be thrown.
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.