ahmed salah

ahmed salah

  • 1.1k
  • 655
  • 41.7k

How to solve error object reference can't assign to null ?

Aug 14 2022 6:52 PM

I work on csharp i get error object reference can't assign to null

code give me error

 var Data = result.items.Select(e => new { PartID = e.create._id, IsUpdated = e.create.error != null && e.create.error.reason !=null && !e.create.error.reason.Contains("document already exists") ? 0 : 1, ErrorStatus = e.create.error == null  | (e.create.error.reason!=null && e.create.error.reason.Contains("document already exists")) ? null : e.create.error.reason }).ToList();

 

 

ElasticPartialUpdat.Create.error.get returned null.

so how to solve error please ?


Answers (2)