you will need to determine which value is null:
in the caller it can be one of:
result
result.items
in the callback one of:
e
e.create
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I work on csharp i get error object reference not set to an instance of an object
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 ?
you will need to determine which value is null:
in the caller it can be one of:
result
result.items
in the callback one of:
e
e.create
Use "||" instead of "|". "|" evaluates both operands for final result. In your case , the 2nd operand of "|" i.e e.create.error.reason is throwing object reference not set error.