I have estimated a courious effect with null propagation as you can see here:
1. string x = "SomeString";
2. Console.WriteLine(! x?.Equals(null) ?? (false) ? true : false); // true
3. Console.WriteLine(! x?.Equals(null) ?? (true) ? false : true); // false (!)
4. Console.WriteLine(! x?.Equals(null)); // true
Can someone explain why the expression in Line 3. evaluates to false? As I understand the null propagation operator ?? is only executed, if an expression is null, but as you can see in line 4. the expression to the left evaluates to true, and not to null.
So if !x?.Equals(null) is true, why the null propagation to the right ?? (true) ? false : true changes this value to false?
I'm sure the error is to me and my understanding, but I have broken this error down now for hours, and I am really confused. Thanks for any explanation to this.