Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HashMap equivalent in VB.net ?

Status
Not open for further replies.

RebLazer

Programmer
Jun 7, 2002
438
US
In C++ there is a container class called a "map" which can create key-value pairs and much of the ease of working with dynamically sorted and allocated array is taken care of by the STL. A similar class would be a Java HashTable.

What is there like that in VB.net? I need it to contain word/value pairs.

Thanks,
Lazer
 
.NET has a Hashtable class which can store key/value pairs. I don't think it supports sorting, though is does dynamically allocate as pairs are added and removed.

Dim ht As New Hashtable()

ht.Add(1, "Hello")

ht.Add(2, " World")

MessageBox.Show(ht.Item(1).ToString & ht.Item(2).ToString)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top