Open In App

ASP Count Property

Improve
Improve
Like Article
Like
Save
Share
Report

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

Last Updated : 19 Mar, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads