-
Scripting.Dictionary is now what?
Anyone know what we should use now if we want to search a collection of objects
by key, and be able to test if a particular key or object exists?
Previously, I used the Scripting.Dictionary object, like:
Private m_dictProjectsSearched As Scripting.Dictionary
Set m_dictProjectsSearched = New Scripting.Dictionary
...
'If we haven't seen it yet...
If Not m_dictProjectsSearched.Exists(arrstrLinks(i)) Then
'Record it, so we'll know we've seen it already
Call dictProjectsSearched.Add(strElement, "")
'Process the string
...
End If
The purpose was to avoid putting duplicate strings in a list.
Is there a more efficient or easier way now? I was thinking of using a HashTable
and the .Contains property...
Roger
-
Re: Scripting.Dictionary is now what?
Look in the System.Collections and System.Collections.Specialized namespaces.
There are three dictionary classes: HybridDictionary, ListDictionary, and
StringDictionary.
The HashTable class also implements the IDictionary interface.
-Rob
"Roger Aikin" <raaikin@nospamplease.fuse.net> wrote:
>
>Anyone know what we should use now if we want to search a collection of
objects
>by key, and be able to test if a particular key or object exists?
>
>Previously, I used the Scripting.Dictionary object, like:
>
>Private m_dictProjectsSearched As Scripting.Dictionary
>Set m_dictProjectsSearched = New Scripting.Dictionary
>
>...
>'If we haven't seen it yet...
>If Not m_dictProjectsSearched.Exists(arrstrLinks(i)) Then
> 'Record it, so we'll know we've seen it already
> Call dictProjectsSearched.Add(strElement, "")
> 'Process the string
> ...
>End If
>
>The purpose was to avoid putting duplicate strings in a list.
>Is there a more efficient or easier way now? I was thinking of using a
HashTable
>and the .Contains property...
>
>Roger
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|