Map 2 strings
I wonder whether there is a Type in VB that enables me to map strings to each other (similar to the std C++ map<type1,type2>). Or do I have to implement it myself.
An array won't do, as I want to avoid iterating through the list everytime I need an element.
What I want to achieve is something like:
Dim x as map ' between strings
Dim s as String
s = x.GetValue("Key3") ' delivers "Value3")
Anybody got an idea?
Use a collection
Dim x As New Collection
x.Add "value1", "key1"
x.Add "value2", "key2"
x.Add "value3", "key3"
x.Add "value4", "key4"
And MsgBox x.Item("key3") will return "value3"
You might also look at the Scripting.Dictionary class in the Microsoft Scripting Runtime (scrrun.dll).
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
By Miha Markic in forum .NET
Last Post: 06-19-2006, 09:48 AM
Last Post: 08-28-2005, 11:36 PM
By Mark Alexander Bertenshaw in forum VB Classic
Last Post: 03-04-2002, 07:04 AM
By Woody Medina in forum Architecture and Design
Last Post: 08-01-2001, 07:40 AM
By mark hembree in forum ASP.NET
Last Post: 01-11-2001, 10:21 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL