[Solved] Short-Circuit If Condition Does not work
In your example you can have TWO different causes for the NullReferenceException: – Value `user` is null; – `user.FirstName` is null. I assume you’ve checked already if user is not null, so lets skip that one. Now lets assume that user.FirstName is null, what happens then? The first condition string.IsNullOrWhiteSpace(user.FirstName) will result to true. Is … Read more