Returning a single value with Linq to SQL

前端 未结 4 1164
臣服心动
臣服心动 2020-12-06 05:28

I\'m learning Linq to SQL and I\'m having trouble grasping it. I\'m trying to simply return a single (boolean) value in C# with a Linq query.

I want to see if the o

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-06 06:15

    If you expect just one result just use Single or SingleOrDefault to get the bool. If you want the first result you can use First or FirstOrDefault.

提交回复
热议问题