471,627 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

Multi string array

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!
Dec 1 '05 #1
1 1809
> 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/

Dec 1 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by rmorvay | last post: by
1 post views Thread by SouthSpawn | last post: by
1 post views Thread by XIAOLAOHU | last post: by

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.