ASP Keys 方法

定义和用法

Keys 方法返回包含 Dictionary 对象中所有 key 的数组。

语法:

  1. DictionaryObject.Keys

实例

  1. <%
  2. dim d,a,i
  3. set d=Server.CreateObject("Scripting.Dictionary")
  4. d.Add "c","China"
  5. d.Add "i","Italy"
  6. d.Add "s","Sweden"
  7.  
  8. Response.Write("<p>Key values:</p>")
  9. a=d.Keys
  10. for i=0 to d.Count-1
  11. Response.Write(a(i))
  12. Response.Write("<br />")
  13. next
  14.  
  15. set d=nothing
  16. %>

输出:

  1. Key values:
  2. c
  3. i
  4. s