Array with string index

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

Is there a way to create an array of strings of subscript of type index too?
Like;

x("Element A")="Value for element A"

Thanks

Regards
 
Hi

Is there a way to create an array of strings of subscript of type index too?
Like;

x("Element A")="Value for element A"

Thanks

Regards

Others have suggested System.Collections.Hashtable, but I would like to
throw out, System.Collections.Specialized.StringDictionary.
 
What are the advantages of StringDictionary over hashtable?

Thanks

Regards

It's typesafe. It only takes strings as keys and only takes strings as
values. Hashtable takes object, so you have to do a lot of casting :)
 
John,
In addition to HashTable & StringDictionary, there are:

System.Collections.DictionaryBase - for creating your own type safe
dictionaries (hash tables)

System.Collections.Specialized.NameObjectCollectionBase - for creating your
own type safe that are keyed by Strings & indexed.

System.Collections.Specialized.NameValueCollection which is similar to
StringDictionary, however also supports being indexed by an integer...

Basically check out the various collections in both System.Collections &
System.Collections.Specialized.

Hope this helps
Jay
 
Back
Top