473,386 Members | 1,764 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.

Passsing an array from derived name

I have a situation where I have a method that I need to call. One of
the parameters of this method is a string[]. There are potentially
several string arrays that I could pass. Based on other information,
I can derive the name of the string array to pass to the called
method. But I can't figure out how to take the derived array name (a
string) and use it to get the actual string[] having that name to pass
as a paramater.

Any help appreciated!

~ Rick
Nov 15 '05 #1
2 1454
There are probably better ways to do this. Can't you just do

If SomeCondition then PassInStringA
If SomeOtherCondition then PassInStringB
....
etc

--
Michael Culley
"Rick" <rb****@allstate.com> wrote in message news:50**************************@posting.google.c om...
I have a situation where I have a method that I need to call. One of
the parameters of this method is a string[]. There are potentially
several string arrays that I could pass. Based on other information,
I can derive the name of the string array to pass to the called
method. But I can't figure out how to take the derived array name (a
string) and use it to get the actual string[] having that name to pass
as a paramater.

Any help appreciated!

~ Rick

Nov 15 '05 #2
What I'm trying to do is something like the following:

public void myFunction( string s1, string s2 )
{
// Assume s1 == "StoreArray" and s2 == "1"
// Also assume I have previously defined an array named
"StoreArray1"

string arrayName = s1 + s2; // arrayName == "StoreArray1"
myOtherFunction( //the array named "StoreArray1" );
...
}

I don't want to have to compare string literals. I would like to find
a way to pass the array named "StoreArray1" as an argument to a called
method. In other words, I'd like to take a name of an array which I
derive from other information, and get access to the array of that
name so that I can pass it as a method argument.

Thanks!

~ Rick

"Michael Culley" <mc*****@NOSPAMoptushome.com.au> wrote in message news:<uX**************@TK2MSFTNGP11.phx.gbl>...
There are probably better ways to do this. Can't you just do

If SomeCondition then PassInStringA
If SomeOtherCondition then PassInStringB
...
etc

--
Michael Culley
"Rick" <rb****@allstate.com> wrote in message news:50**************************@posting.google.c om...
I have a situation where I have a method that I need to call. One of
the parameters of this method is a string[]. There are potentially
several string arrays that I could pass. Based on other information,
I can derive the name of the string array to pass to the called
method. But I can't figure out how to take the derived array name (a
string) and use it to get the actual string[] having that name to pass
as a paramater.

Any help appreciated!

~ Rick

Nov 15 '05 #3

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

Similar topics

5
by: Tommy Lang | last post by:
Hi! I have aa array with pointers to the class(object) Person that I created ( Person *ptr; ). From class person there are two derived classes, student and employee. I can add and remove...
9
by: justanotherguy63 | last post by:
Hi, I am designing an application where to preserve the hierachy and for code substitability, I need to pass an array of derived class object in place of an array of base class object. Since I...
10
by: amparikh | last post by:
Ok, my question is not about Virtual destructors and why, but more on the significance. Generally we have a virtual destructor in the base class ( and inadvertently in the derived class) so that...
5
by: Oeleboele | last post by:
OK, I can't understand this exactly: I have this function: int howdy(void *) I first past this to the function &aCharArray I realized later that this should be aCharArray but... the former...
9
by: Codemonkey | last post by:
Hi, Sorry for a stupid question, but is it possible to do a narrowing conversion with an object array with Option Strict On in VB? E.g: ------------------ Dim aBase as Base() = {New...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
13
by: Jack | last post by:
I have a class called "Base". This class has a protected member variable "m_base" which can be retrieved using the public member function "GetBaseMember". "m_base" is initialized to "1" and is...
57
by: buuuuuum | last post by:
why array can't be assigned, like structs?
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.