📜  ASP 计数属性

📅  最后修改于: 2022-05-13 01:56:18.789000             🧑  作者: Mango

ASP 计数属性

ASP Count 属性用于返回当前存在于 Dictionary 对象中的键值对的数量。

句法:

DictionaryObject.Count

示例:下面的代码演示了 ASP Dictionary.Count 属性。

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("
Current number of entries: " & dict.Count)    set dict=nothing %>


输出:

Current number of entries: 3
Current number of entries: 4