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
完整的Dictionary對象參考手冊