I keep getting a null reference error when I am trying to check if something is null. I have a class called User and I initialize the variable indvUser like so
User indvUser = api.Users.SearchByExternalId(session.UserInfo.UserId.ToString())
.Users.FirstOrDefault();
Then I want to check if indvUser is null like this
if (indvUser.Equals(null))
{
int a = 1;
}
But I get a null reference error when using Equals(null) which I don't understand. If it actually is null i.e. there is no value, shouldn't Equals(null) return true?
if (indvUser == null)??