# Exists 方法
object.Exists(key)
如果在 Dictionary 对象中存在指定键,返回 True;如果不存在,返回 False。
| 参数 | 描述 | 
|---|---|
| object | 必选项。总是 Dictionary 对象名称。 | 
| drivespec | 必选项。在Dictionary 对象中查找的Key 值。 | 
说明 下面例子举例说明如何使用Exists 方法:
Function KeyExistsDemo
    Dim d, msg              '创建一些变量。
    Set d = CreateObject("Scripting.Dictionary")
    d.Add "a", "Athens"     '添加一些键和项目。
    d.Add "b", "Belgrade"
    d.Add "c", "Cairo"
    If d.Exists("c") Then
        msg = "指定的键存在。"
    Else
        msg = "指定的键不存在。"
    End If
    KeyExistsDemo = msg
End Function
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
应用于
 