Sorry for this awkward example, but I want to keep it as to the point as possible
Lets say, I have parsed a json-file, which gives me the hierarchy below
var customers = myObj.SubObj?.CustomerList.EmptyIfNull();
var plusCustomers = customers.Where(...) // Resharper warning
myobj cannot be null SubObject can be null sometimes
I have an extension method
IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> enumerable) => enumerable ?? Enumerable.Empty<T>();
So I expect the plusCustomers-line to be safe(empty list instead of null). But I get a warning
possible "null"assignment to a non-nullable entity
If I replace the first line with
var customers = myObj.SubObj.CustomerList.EmptyIfNull();
I get rid of the warning, but that is not correct. How can I convince Resharper that this is ok?...or I'm I mistaken?