0

我有一个 LINQ 代码来从数据表中提取值。

 Dim dWYLDs = (From myrow In oSubData 
 Where mySubbasins.Contains(myrow("Subbasin"))
 Group By xs = Val(myrow("X"))
 Into myTotal = Sum(Val(myrow("WYLD")))).ToArray

我想得到一个WYLD的单曲数组(作为双精度)。相反,在检查行

( using .GetType method),我有...

VB$AnonymousType_1`2[System.Double,System.Double]

如何将其转换为数组?我的语法有问题吗?

4

1 回答 1

0

我不太确定如何使用您拥有的 Into 子句获得您需要的东西,但大致如下: -

 Dim dWYLDs = (From myrow In oSubData 
 Where mySubbasins.Contains(myrow("Subbasin"))
 Group By xs = Val(myrow("X"))
 Select CType (Sum(Val(myrow("WYLD"))), Double)).ToArray

至少可以提供一个起点。

于 2013-10-10T10:19:32.957 回答