Null propagation operator, out parameters and false compiler errors?
问题 Let's assume I have a class that has a property of type Dictionary<string,string> , that may be null. This compiles but the call to TryGetValue() could throw at a NullRef exception at runtime: MyClass c = ...; string val; if(c.PossiblyNullDictionary.TryGetValue("someKey", out val)) { Console.WriteLine(val); } So I'm adding a null-propagating operator to guard against nulls, but this doesn't compile: MyClass c = ...; string val; if( c.PossiblyNullDictionary ?. TryGetValue("someKey", out val) ?