yamid

yamid

  • NA
  • 98
  • 0

How to use a string as a name of a variable in c#

Dec 17 2010 9:07 AM

Hi mates,
How to use a string , to be a variable name, for example

suppose X="WELL"
then I want to have an array with this name -> double [] WELL = new double[10];

more specifically I want to create a set of arraies, in which the name of array is obtained by a loop:

for ( int i=0;i<20;i++)
{
string X= "WELL"+i.ToString();
double [] X = new double [10]; //???
}
Then I want to have a set of array :
double [] WELL1 =new double [10];
double [] WELL2 =new double [10];
...
double [] WELL19 = new double[10];

Thanks,

Answers (2)