title: interop.excel convert Range Object(,) to Double(,)
body: <p>I have a Microsoft.Office.Interop.Excel.Range Object obtained as shown:</p>
  
  <pre><code>Dim maxRow As Integer = currentSheet.UsedRange.Rows.Count
  currentSheet.Range("A2").Resize(maxRow-1, 2).Value
  </code></pre>
  
  <p>and I'm trying to convert that to a 2 dimensional array of doubles, but if I do:</p>
  
  <pre><code>Dim arrayData(,) As Double = currentSheet.Range("A2").Resize(maxRow - 1, 2).Value
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>Additional information: Unable to cast object of type
    'System.Object[,]' to type 'System.Double[,]'.</p>
  </blockquote>
  
  <p>Is there a simple way to obtain the data from a spreadsheet as an array of doubles? I could loop over each element in the array, but it seems like that shouldn't be necessary. </p>