我试图将以下代码段放到一行中。我挣扎着,但是 我总是得到编译器警告。
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?
答案 0 :(得分:0)
只需将Distinct
来电添加到第一行:
Dim puertas As VehiculoType() = (From item In ListaVehiculos _
Select New VehiculoType() With _
{.Puertas = item.Puertas}).Distinct