ASP Add 方法

Add 方法向 Dictionary 对象添加一个新的 key/item 对。
注意:如果 key 已经存在,则会出现错误。
语法
DictionaryObject.Add(key,item)
参数 | 描述 |
---|---|
key | 必需的。与 item 相关联的 key 值。 |
item | 必需的。与 key 相关联的 item 值。 |
实例
<%
Dim d
Set d=Server.CreateObject("Scripting.Dictionary")
d.Add "re","Red"
d.Add "gr","Green"
d.Add "bl","Blue"
d.Add "pi","Pink"
Response.Write("The value of key gr is: " & d.Item("gr"))
%>
输出:
The value of key gr is: Green
Dim d
Set d=Server.CreateObject("Scripting.Dictionary")
d.Add "re","Red"
d.Add "gr","Green"
d.Add "bl","Blue"
d.Add "pi","Pink"
Response.Write("The value of key gr is: " & d.Item("gr"))
%>
输出:
The value of key gr is: Green
