`
peizhiinfo
  • 浏览: 1425647 次
文章分类
社区版块
存档分类
最新评论

【软件测试自动化-VBScript基础讲座 4】== Dictionary 对象 ==

 
阅读更多

Rss订阅IQuickTest关于如何订阅?

作者:zzxxbb112
时间:2009/11/19版权所有,侵权必究。

出处:http://blog.csdn.net/zzxxbb112


这次课程我们主要来讲解DICTIONARY对象的使用,讲解此对象的目的是为了后续在讲解《测试对象字典的应用》以及《面向对象的代码设计模式》做铺垫。因此虽然本次课程内容相对较为简单,但是DICTIONARY这个知识点是非常重要的,在后续的课程内容中我们会经常用到,因此希望大家在看完之后能够多多实践,掌握好它为后续课程打好扎实的基础。

  • Dictionary ---- 字典对象

说明:一个能够增删改的容器,同时也是一个COM组件

  • 添加项

Set dic=CreateObject("Scripting.Dictionary")
dic.Add "a","test was a"
dic.Add "b","test was b"
dic.Add "c","test was c"
MsgBox dic.Item("a") 'item可省略

  • 删除项

Set dic=CreateObject("Scripting.Dictionary")
dic.Add "a","test was a"
dic.Add "b","test was b"
dic.Add "c","test was c"
MsgBox dic.Count '3个
dic.Remove("a")
MsgBox dic.Count '2个
Msgbox dic("a") '已空

  • 修改项

Set dic=CreateObject("Scripting.Dictionary")
dic.Add "a","test was a"
dic.Add "b","test was b"
dic.Add "c","test was c"

MsgBox dic("a") '修改之前
dic.Item("a")="zzxxbb112"
MsgBox dic("a") '修改之后

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics