Observation: If text is null, this method returns True. I expected False.
return text?.IndexOf('A') != -1;
When I reflect the above line using ILSpy (or inspect the IL), this is the generated code:
return text == null || text.IndexOf('A') != -1;
Here is what I really need to meet my expectation:
return text != null && text.IndexOf('A') != -1;
Question: Does someone have a good explanation about why the Null Conditional code generated the OR expression?
Full Sample at: https://dotnetfiddle.net/T1iI1c