Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Changing index of Hashtable

  1. #1

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Resolved [RESOLVED] [2005] Changing index of Hashtable

    Hi.
    I have a hashtable filled with sereral elements.
    I want to move a element up or down 1 position in the hashtable, is is possible and how?
    Thanks.
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Changing index of Hashtable

    Firstly, you should use a generic Dictionary in preference to a Hastable in .NET 2.0.

    Secondly, moving items up or down in a Hashtable has no meaning because they aren't ordered. The items have no index so you can't change their index. The point of a Hashtable is fast retrieval of values by key. There are SortedList and SortedDictionary classes that combine hashing and sorting, so maybe that's what you need.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: [2005] Changing index of Hashtable

    Ok, i will drop the hashtable then.
    "The dark side clouds everything. Impossible to see the future is."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width