2D array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I declare and ADD to a 2D array ?

I declared it as:
string[,] stdAnswer = new String[2,50];

Usually in a 1D array, adding would be done by:
ArrayList values = new ArrayList();
values.Add ("IN");

TIA.
 
if your data looks like this

column1 column2
a 1
b 2
c 3

then

strAnswer[0,0] = "a";
strAnswer[0,1] = "1";
strAnswer[1,0] = "b";
strAnswer[1,1] = "2";
strAnswer[2,0] = "b";
strAnswer[2,1] = "3";

so, [value,value] means [rowindex, columnindex]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top