Multi string array

A

Arjen

Hi,

I want to have a multi string array, but I don't know the syntax.

private string[???] myArray = new string[???]
{
{"1", "a", " ", " "},
{"2", "b", " ", " "},
{"3", "c", " ", " "}
}

Can someone help?

Thanks!
 
?

=?iso-8859-1?Q?Anders=20Nor=e5s?=

I want to have a multi string array, but I don't know the syntax.
private string[???] myArray = new string[???]
{
{"1", "a", " ", " "},
{"2", "b", " ", " "},
{"3", "c", " ", " "}
}
I take that you want to declare a multidimensional array. Below is your examle
using a multidimensional array.
string[,] arr = {
{"1","a","",""},
{"2","b","",""},
{"3","c","",""},
};

...if you're looking for a jagged array, which is an array of arrays the code
looks like this:
string[][] arr=new string[][]
{
new string[] {"1","a","",""},
new string[] {"2","b","",""},
new string[] {"3","c","",""},
};

Anders Norås
http://dotnetjunkies.com/weblog/anoras
 

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

Similar Threads


Top