LINQ Distinct()

后端 未结 2 1505
挽巷
挽巷 2021-02-12 13:42

I am working on getting the results of this sql query in LINQ

SELECT DISTINCT(Type)
FROM  Product
WHERE categoryID = @catID

this is my

2条回答
  •  孤街浪徒
    2021-02-12 14:21

    return (from p in qry
           where p.CatId.Equals(CatID)
           select p.Type).Distinct();
    

    This matches what your provided SQL Query should be doing.

提交回复
热议问题