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 Sub
Notes
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.
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.