title: Error Returning A Dictionary From A Function
body: <p>I have created a function to group data..</p>
  
  <blockquote>
  <pre><code>Private Function GroupData(ByVal validData As DataSet) As Dictionary(Of [String], List(Of DataRow))()
  
          Dim serviceGroupDataset As DataSet = validData.Clone
  
          Dim grouped As New Dictionary(Of [String], List(Of DataRow))()
          Dim groupedRows As List(Of DataRow) = New List(Of DataRow)
  
          For Each r As DataRow In validData.Tables("Detail").[Select]()
  
              Dim key As [String] = r(AuthorizatonConstants.VA_Authorization_ID).ToString().Split("-"c)(0)
  
              If Not grouped.TryGetValue(key, groupedRows) Then
                  groupedRows = New List(Of DataRow)()
                  grouped(key) = groupedRows
              End If
  
              groupedRows.Add(r)
          Next
  
  //COMPILE ERROR
          Return grouped
      End Function
  </code></pre>
  </blockquote>
  
  <p>I am getting a compile error when trying to return the dictionary..</p>
  
  <pre><code>Value of type 'System.Collections.Generic.Dictionary(Of String, System.Collections.Generic.List(Of System.Data.DataRow))' cannot be converted to '1-dimensional array of System.Collections.Generic.Dictionary(Of String, System.Collections.Generic.List(Of System.Data.DataRow))'.
  </code></pre>
  
  <p>How can I return the grouped dictionary from the function?</p>