0

I have following code. On executing in throws NRE on initializing model.

var model = new EmployeeModel { };

if (responseUsers.Any(x => x.EmployeeId == model.EmployeeId))
{
    logger.Warn("Issue with employee");
}

BUT when I remove or comment that LINQ expression with Any, everything works fine. It looks like completely magic for me and I have no idea why does it work so. Don't know how expression coming after object initialization could affect that initialization. Does someone has any ideas?

p.s. Actually, I have some properties in that model object and I populate them on initialization, but is doesn't affect the issue.

Alexey Koptyaev
  • 114
  • 3
  • 12

0 Answers0