Visual Basic Scripting Edition | 語言參考 |
Remove 方法從 Dictionary 對(duì)象中刪除鍵和項(xiàng)目對(duì)。 object.Remove(key)
參數(shù)object 必選項(xiàng)。應(yīng)為 Dictionary 對(duì)象的名稱。 key 必選項(xiàng)。與要從 Dictionary 對(duì)象中刪除的鍵和項(xiàng)目對(duì)相關(guān)聯(lián)的 Key。 說明如果指定的鍵和項(xiàng)目對(duì)不存在,則會(huì)出現(xiàn)錯(cuò)誤。 下列代碼示范如何使用 Remove 方法: Dim a, d ' 創(chuàng)建變量。
Set d =CreateObject("Scripting.Dictionary") d.Add "a", "Athens" ' 添加鍵和項(xiàng)目。
d.Add "b", "Belgrade" d.Add "c", "Cairo" ... a =d.Remove("b") ' 刪除第二個(gè)項(xiàng)目對(duì)
請(qǐng)參閱Add 方法(Dictionary) | Exists 方法 | Items 方法 | Keys 方法 | RemoveAll 方法 應(yīng)用于: Dictionary 對(duì)象 返回首頁 |