Distinct in LINQ with anonymous types (in VB.NET)

后端 未结 5 1459
醉梦人生
醉梦人生 2020-12-16 20:29

Supposing the referenced List below contains 2 elements:

Dim Countries = From c In List _
                Select New With { .Country = c.Country         


        
5条回答
  •  旧时难觅i
    2020-12-16 21:08

    Dim Countries = From c In List _
                     Select New With {.Country = c.Country, .CountryID = c.CountryID }.Distinct() 
    

提交回复
热议问题