ASP Keys 方法


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

语法

  1. DictionaryObject.Keys

实例

  1. <%
    dim d,a,i
    set d=Server.CreateObject("Scripting.Dictionary")
    d.Add "n","Norway"
    d.Add "i","Italy"
    d.Add "s","Sweden"

    Response.Write("<p>Key values:</p>")
    a=d.Keys
    for i=0 to d.Count-1
      Response.Write(a(i))
      Response.Write("<br>")
    next

    set d=nothing
    %>

    输出:

    Key values:

    n
    i
    s