query result what should i use Count() or Any()

后端 未结 2 655
星月不相逢
星月不相逢 2021-01-27 07:37

I am checking login of a user by this repository method,

  public bool getLoginStatus(string emailId, string password)
    {
        var query = from r in taxidb         


        
2条回答
  •  时光取名叫无心
    2021-01-27 08:32

    You could express it quite a bit shorter like this:

    return taxidb.Registrations.Any(r => r.EmailId == emailId && r.Password==password);
    

提交回复
热议问题