Name
Count
Synopsis
Integer = Application.Count
Returns an
Integer containing the number of items currently in the Application
collection. The Count member is derived from the ICollection
interface, which is implemented by the
HttpApplicationState class.
Parameters
-
Integer An Integer variable that will receive the Count property value.
Example
The example adds two values to the Application collection, displays the count of items in the Application collection, and then uses the Count property as a looping control value to display each item:
Sub Page_Load( )
Application.Clear( )
Application("foo") = "Hello, "
Application("bar") = "World!"
Message.Text = "The Application collection contains " & _
Application.Count & " items: "
Dim I as Integer
For I = 0 To Application.Count - 1
Message.Text &= Application(I)
Next
End SubNotes
The Count property is new for ASP.NET. In addition to using the Count property for looping through the Application collection, you can use the property to keep track of how many items the Application stores at any given time. For example, you could write this information to a log for later review.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access