473,386 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Array with string index

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
Nov 20 '05 #1
7 12657
Hi,

Take a look at the hash table.
http://msdn.microsoft.com/library/de...classtopic.asp
Ken
----------------
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #2
* "John" <jo**@nospam.infovis.co.uk> scripsit:
Is there a way to create an array of strings of subscript of type index too?


'Hashtable' class.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
"John" <jo**@nospam.infovis.co.uk> schrieb

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

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


Hashtable
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
In article <es**************@TK2MSFTNGP12.phx.gbl>, John wrote:
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.

--
Tom Shelton [MVP]
Nov 20 '05 #5
What are the advantages of StringDictionary over hashtable?

Thanks

Regards
"Tom Shelton" <to*@mtogden.com> wrote in message
news:eg**************@TK2MSFTNGP11.phx.gbl...
In article <es**************@TK2MSFTNGP12.phx.gbl>, John wrote:
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.

--
Tom Shelton [MVP]

Nov 20 '05 #6
In article <O0*************@tk2msftngp13.phx.gbl>, John wrote:
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 :)

--
Tom Shelton [MVP]
Nov 20 '05 #7
John,
In addition to HashTable & StringDictionary, there are:

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

System.Collections.Specialized.NameObjectCollectio nBase - 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

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Denis Perelyubskiy | last post by:
Hello, I need to make an array of elements accross forms. My javascript skills, as evident from this question, are rather rudimentary. I tried to make an associative array and index it with...
47
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they...
7
by: Robert Mark Bram | last post by:
Hi All! How do you get the length of an associative array? var my_cars= new Array() my_cars="Mustang"; my_cars="Station Wagon"; my_cars="SUV"; alert(my_cars.length);
38
by: VK | last post by:
Hello, In my object I have getDirectory() method which returns 2-dimentional array (or an imitation of 2-dimentional array using two JavaScript objects with auto-handled length property - please...
11
by: deko | last post by:
I need to create a basic one-dimensional array of strings, but I don't know how many strings I'm going to have until the code is finished looping. pseudo code: Dim astrMyArray() Do While Not...
7
by: Peter | last post by:
I want to create a multidemensional arraylist. Seeing as they don't exist I was wondering if there is a way to create a class that works like one. I basically want to use it like this Dim...
3
by: Ben | last post by:
Hi I am creating a dynamic function to return a two dimensional array from a delimeted string. The delimited string is like: field1...field2...field3... field1...field2...field3......
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
2
by: JJA | last post by:
I'm looking at some code I do not understand: var icons = new Array(); icons = new GIcon(); icons.image = "somefilename.png"; I read this as an array of icons is being built. An element of...
5
by: trifinite | last post by:
I am having difficulty understanding why the following code does not result in error. The code below simply traverses a string, extracting any continuous sequence of digits (0 - 9) and placing them...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.