c# LINQ: how to retrieve a single result

后端 未结 8 1398
梦如初夏
梦如初夏 2020-12-29 07:00

Kind of new to linq,

whats the simplest way to retrieve a single result using linq?

example, my query

var query =
     from c in db.productIn         


        
8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 07:15

    msdn : SingleOrDefault

    Make use of Single() or SingleOrDefault() method to get result

    Also check : Default Extension methods

提交回复
热议问题