<%
Dim oDic,aItems,aKeys
Set oDic = Server.CreateObject("Scripting.Dictionary")
'添加
oDic.Add "aaa",111
oDic.Add "bbb",222
oDic.Add "ccc",333
oDic.Add "ddd",444
'修改
If oDic.Exists("aaa") Then
oDic.key("aaa") = "eee" 'key属性,只读
oDic.item("eee") = 555 'item属性,可读写
End If
'列表
aKeys = oDic.Keys
aItems = oDic.Items
For i=0 To oDic.Count-1
Response.Write(aKeys(i) & "," & aItems(i))
Next
'删除
Response.Write(oDic.Count)
oDic.Remove("eee") '从 Dictionary 对象中删除键和项目对
Response.Write(oDic.Count)
oDic.RemoveAll() '删除 Dictionary 对象中的所有键和项目对
Response.Write(oDic.Count)
Set oDic = Nothing
%>
评论(0)
暂无评论。