473,780 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12677
Hi,

Take a look at the hash table.
http://msdn.microsoft.com/library/de...classtopic.asp
Ken
----------------
"John" <jo**@nospam.in fovis.co.uk> wrote in message
news:es******** ******@TK2MSFTN GP12.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.in fovis.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.in fovis.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.Collecti ons.Hashtable, but I would like to
throw out, System.Collecti ons.Specialized .StringDictiona ry.

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

Thanks

Regards
"Tom Shelton" <to*@mtogden.co m> wrote in message
news:eg******** ******@TK2MSFTN GP11.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.Collecti ons.Hashtable, but I would like to
throw out, System.Collecti ons.Specialized .StringDictiona ry.

--
Tom Shelton [MVP]

Nov 20 '05 #6
In article <O0************ *@tk2msftngp13. phx.gbl>, John wrote:
What are the advantages of StringDictionar y 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 & StringDictionar y, there are:

System.Collecti ons.DictionaryB ase - for creating your own type safe
dictionaries (hash tables)

System.Collecti ons.Specialized .NameObjectColl ectionBase - for creating your
own type safe that are keyed by Strings & indexed.

System.Collecti ons.Specialized .NameValueColle ction which is similar to
StringDictionar y, however also supports being indexed by an integer...

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

Hope this helps
Jay

"John" <jo**@nospam.in fovis.co.uk> wrote in message
news:es******** ******@TK2MSFTN GP12.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
6533
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 the object references. However, I just realized that indices may only be referenced by strings.
47
5093
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 are not at all. If you are doing *array", then you have to use only integer values for array index, as it was since ALGOL.
7
39848
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
5235
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 let's us do not go into an "each dot over i" clarification discussion now - however you want to call - you call it ;-) array contains records of all files in the current dir. array contains records of all subs in the current dir
11
39469
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 rst.EOF i = i + 1 If rst!Something = Then astrMyArray(i) = rst!Something
7
1555
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 MyArray as classNewArray MyArray.add("Data1", "Data2") or the looping claus....
3
9670
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... field1...field2...field3...
23
7417
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 in an array. The application compiles but aborts without giving me any useful information. What I suspect is happening is infinite recursion. Each Directory object creates an array of Subdirectories each of which has an array of...
2
2517
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 the array is an object itself but what is this syntax of the consecutive double quotes inside the brackets ?
5
2289
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 into a separate array. For example, the following string: abc1&qwerty22.xyz0321ijk5Q_ #*9 should produce the array: . Given the array declaration char next_number, where MAX_DIGITS is defined to be 8, the number of consecutive digits that can...
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.