ASP Count Property
Last Updated :
19 Mar, 2021
The ASP Count Property is used to return the number of key-value pairs currently present in the Dictionary Object.
Syntax:
DictionaryObject.Count
Example: The below code demonstrates the ASP Dictionary.Count Property.
ASP
<%
dim dict
'Create a new dictionary
set dict=Server.CreateObject("Scripting.Dictionary")
' Add values to the dictionary
dict.Add "p" , "physics"
dict.Add "c" , "chemistry"
dict.Add "m" , "maths"
'Count the number of key-value pairs
Response.Write("Current number of entries: " & dict.Count)
' Add one more value
dict.Add "b" , "biology"
'Count the number of key-value pairs again
Response.Write( "<br>Current number of entries: " & dict.Count)
set dict=nothing
%>
|
Output:
Current number of entries: 3
Current number of entries: 4
Share your thoughts in the comments
Please Login to comment...