Hi everyone,

I'm developing a custom control in which I sift through the contents of an
XML document and populate a jagged array (an array with a variable number of
elements, but always has 2 values for each element). Even though I'm only
populating an Array with a key/value pair, I can't use a Hashtable or
SortedList object because of the erratic sorting inhernent in both data
types...I need it to display information as entered into the array.

I'm trying to loop through the array, but I keep getting the error message:
"Cannot apply indexing with [] to an expression of type 'System.Array'" when
trying to access the values with my code. It looks cut-and-dry (or so I
thought), but it won't work.

Here's my code:

private Array GetFiles(string fileProperty)
{
FileStream fs = new
FileStream(fileProperty,FileMode.Open,FileAccess.Read);
StreamReader sr = new StreamReader(fs);
DataSet ds = new DataSet();
ds.ReadXml(sr);
fs.Close();

DataTable table = ds.Tables[0];
DataRow[] rows = table.Select();

// POPULATE THE ARRAY HERE
string[][] arrSubmissions = new string[rows.Length][];
for(int i=0;i<rows.Length;i++)
{
arrSubmissions[i] = new string[2] {
rows[i]["link"].ToString(),rows[i]["title"].ToString() };
}
return arrSubmissions;
}

protected override void Render(HtmlTextWriter writer)
{
// CALL THE PRIVATE HELPED METHOD
Array sl = GetFiles(DataFile);
for(int i=0;i<sl.Length;i++)
{
for(int j=0;j<sl[i].Length;j++)
{
// THIS LINE CAUSES THE ERROR
writer.Write("{0}",sl[i][j].ToString());
}
}
}

Any ideas?

Thanks!
Jas