Scripting.Dictionary is now what?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Scripting.Dictionary is now what?

  1. #1
    Roger Aikin Guest

    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

  2. #2
    Rob Teixeira Guest

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center