This project is read-only.
3
Vote

Null propagation operator should be recognized as simple name by anonymous types

description

Code:
public class C {
    public C P { get { return null; } }
}

var c = new C();
var a = new { c?.P };
Expected:
A new instance of anonymous type is created, type has property P.

Actual:
error CS0746: Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.

comments