Visual Basic Scripting Edition | 語(yǔ)言參考 |
返回一數(shù)組,其中包含有 Dictionary 對(duì)象的所有現(xiàn)存鍵。
object.Keys
object 應(yīng)為 Dictionary 對(duì)象的名稱(chēng)。
下列代碼舉例說(shuō)明如何使用 Keys 方法:
Function DicDemo Dim a,d,i
'
創(chuàng)建一些變量。Set d = CreateObject("Scripting.Dictionary")
d.Add "a","Athens"
'
添加鍵和項(xiàng)目。d.Add "b","Belgrade"
d.Add "c","Cairo"
a = d.Keys
'
獲取鍵。For i = 0 To d.Count -1
'
循環(huán)使用數(shù)組。s = s & a(i) & "<BR>"
'
返回結(jié)果。Next
DicDemo = s
End Function
Add (Dictionary)方法 | Exists 方法 | Items 方法 | Remove 方法 | RemoveAll 方法
應(yīng)用于: Dictionary 對(duì)象