I am developing an application in .NET Core 7.0. See the code block below shows the condition that works and the one that doesn't.
Please suggest why is it happening?
Thanks.
Update:
Here is the code snippet.
User dbUser = databaseUsers.FirstOrDefault(x => x.Key == user.ObjectGuid).Value;
if (dbUser != null)
{
// Handle user when it' null
}
The databaseUsers is a SortedDictionary<string, User>. When the dbUser null it still go inside the if condition and only behave correctly when i change the condition to "dbUser is not null".