HashTables are a bunch of nonordered objects reordering themselves to chaos

By patrickwellink
May 13, 2005
1

Ok as a VB programmer I was used to collections instead of Hashtables….Today I used a hashtable cause i thought a hashtable was almost the same as a collection.


I also thought the HashTable was the C# equivalent of a collection, So I started a nice VB project….


ms.Add(“key3”, Nothing)
ms.Add(“key2”,
Nothing
)
ms.Add(“key1”,
Nothing
)
For Each key As String In
ms.Keys
       Debug.WriteLine(key)
Next


This produced :


key1
key3
key2


So the order in the hashtable NOT the order they were added to the hashtable….
I think I stick to the collection…..


Dim ms As New Collection
ms.Add(“key3”, “key3”)
ms.Add(“key2”, “key2”)
ms.Add(“key1”, “key1”)
For x As Integer = 1 To
ms.Count
       Debug.WriteLine(ms(x))
Next


Produces


key3
key2
key1


btw what is the real equivalent of a collection in C#…..come on give a reply and help me on my way…..

Comments: 1

  1. Patrick Wellink says:

    ja jan die haddik natuurlijk al meteen gelezen…….

    je ken ook gewoon meteen in VB. beginnen….

    Dun heb je ook meteen een normal Isnummeric 😉

Comments are closed.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta