LINQ with String.Join() error: "System.InvalidCastException: Unable to cast object of type '<DistinctIterator>
<p>I'm trying to grab the distinct values of one column from a datatable using linq and use string.join to create a single string from the results but am getting:</p>

<p>"System.InvalidCastException: Unable to cast object of type 'd__7a`1[System.String]' to type 'System.String[]'."</p>

<p>My code is:</p>

<pre><code>Dim retString As String = ""

Dim uniqueCC2 = (From d As DataRow In dt.AsEnumerable() _
                 Select d.Field(Of String)("CageCardID")).Distinct

Try
     'I get the error on the following line
     retString = String.Join("&lt;/li&gt;&lt;li&gt;", uniqueCC2)
Catch ex As Exception
    ...error code...
End Try

Return "&lt;li&gt;" &amp; retString &amp; "&lt;/li&gt;"
</code></pre>

<p>I have also tried this LINQ statement, but get the same error:</p>

<pre><code>Dim uniqueCC2 = dt.AsEnumerable().Select(Function(s As DataRow) s.Field(Of String)("CageCardID")).Distinct()
</code></pre>

<p>The column in question (CageCardID) is varchar(8)...so a string.</p>

<p>When I dive into uniqueCC2 it shows the values as strings.</p>

<p>Any help would be appreciated.</p>

<p>Thanks,</p>

<p>George</p>