【发布时间】:2012-12-19 02:14:01
【问题描述】:
我在这里找到了可以回答一半问题的主题: Does Scripting.Dictionary's RemoveAll() method release all of its elements first?
在我的例子中,值是字典的实例,所以我有字典对象的嵌套层次结构。
我的问题是我是否需要在每个子词典上调用 RemoveAll?
' just for illustration
Dim d As Dictionary
Set d = New Dictionary
Set d("a") = New Dictionary
Set d("b") = New Dictionary
' Are the next section of code necessary?
' -------------------- section start
Dim key As Variant
For Each key In d
d.Item(key).RemoveAll
Next
' -------------------- section end
d.RemoveAll
Set d = Nothing
【问题讨论】:
-
必要是什么意思?你想完成什么?
-
我想释放所有对象,正如我所读(在上面的主题中),RemoveAll 将所有对象设置为 Nothing,非常好,但不确定该函数是否是递归的。
标签: syntax dictionary vb6 removeall