This project is read-only.
2

Resolved

Null propagation expression + void methods

description

public class C {
    public void M(int value) {
        this?.M(var t = 42);
    }
}
Produces:
  • error CS0023: Operator '?' cannot be applied to operand of type 'void'
  • error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
Expected behavior:
  • Compiles without code, produced code equal to if (this != null) this.M(var t = 42);