title: retrieve 2d array from an object and bind to GridView
body: <p>I have a function that returns a 2 dimensional array.  Due to the nature of the program I MUST declare it as an object. 
  Like this</p>
  
  <pre><code>object o1 = function(x);    //note the function returns something similar to this {string[x,y]};
  </code></pre>
  
  <p>ultimately I want to bind this data to a GridView.<br>
  If the array is <strong>one dimensional</strong>...the following method works fine.</p>
  
  <pre><code>gridView.DataSource = o1;
  
  gridView.DataBind();
  </code></pre>
  
  <p>it doesn't work for multidimensional arrays.</p>
  
  <p>I WOULD use the following code to turn the array of strings into a DataTable</p>
  
  <pre><code>DataTable dt = new DataTable();
  
  dt.Columns.Add("Name", Type.GetType("System.String"));
  
  dt.Columns.Add("Age", Type.GetType("System.String"));
  
  dt.Columns.Add("Sex", Type.GetType("System.String"));  
  
  for (int i = 0; i &lt; 5; i++)
  {
  
      dt.Rows.Add();
  
      dt.Rows[dt.Rows.Count - 1]["Name"] = o1[i, 0];
  
      dt.Rows[dt.Rows.Count - 1]["Age"] = o1[i, 1];
  
      dt.Rows[dt.Rows.Count - 1]["Sex"] = o1[i, 2];
  
  }
  
  GridMultiD.DataSource = dt;
  
  GridMultiD.DataBind();  
  </code></pre>
  
  <p>the problem is obviously that the object is not actually an array...but <em>contains</em> an array.  Is it possible to access it?  All the Google hits I get are people asking how to make object arrays...</p>
  
  <p>Any ideas to simplify the situation are also greatly appreciated, thanks!</p>
  
  <p>-Dave</p>
  
  <p>note:  the array is
   being returned by a DCOM server... so it MUST be returned as an object...I think...</p>