Resharper is a great tool, but sometimes I am confused by what the proposed code actually means. I have this code:
private bool DoesUserExists()
{
var user = De.Users.FirstOrDefault(u => u.Username == CurrentUser.Username);
return user != null;
}
I originally had:
if(user == null)
return false;
else
return true;
But Resharper suggested the upper code. However, it seems to me that I'm talking about the return of the user if he is not null. But the method only accepts a bool return, not a class.
So what does the user return! = Null, really returned when it is zero, and when not?
source
share