
Set | 287
Application
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Notes
The RemoveAll method is provided for backwards compatibility with classic
ASP. In classic ASP, this method was accessed through the Contents collection.
In ASP.NET, this method can be accessed either directly, as shown above, or
through the Contents collection.
RemoveAt
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.
Parameter
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 collec-
tion 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 ...