Using 'Dictionary<>' class

  • 9 years ago

    => Just for an straight easy way :

    string[] myStringArray = { "value1", "value2", "value3" }; Dictionary<string, object> objects = new Dictionary<string, object>(); // pair of 'object name'(string) and 'object value'(object) (instead of 'object' type, you can use your type 'myObject') // optionally, you can create all of your objects in this way :foreach (string object_name in myStringArray)objects[object_name] = new myObject(); // then you can use each of your objects like this :

    // objects[myStringArray[1]]

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook