Linq分在一条线上

时间:2013-06-08 18:27:38

标签: vb.net linq distinct

我试图将以下代码段放到一行中。我挣扎着,但是 我总是得到编译器警告。

Dim puertas As VehiculoType() = From item In ListaVehiculos _
              Select New VehiculoType() With _
              {.Puertas = item.Puertas}


Dim sel As VehiculoType() = (From item In puertas Select item).Distinct

如何在一个语句中进行linq选择,包括distinct?

1 个答案:

答案 0 :(得分:0)

只需将Distinct来电添加到第一行:

Dim puertas As VehiculoType() = (From item In ListaVehiculos _
              Select New VehiculoType() With _
              {.Puertas = item.Puertas}).Distinct