Throw Expressions not working for Boolean expressions?

Viewed 241

Throw Expressions work in this case:

string myStr;

public MyObj( string myStr ) =>
    this.myStr = myStr ?? throw new ArgumentNullException( "myStr" );

But why doesn't this compile too?

bool isRunning;

public void Run() =>
    isRunning = !isRunning || throw new InvalidOperationException( "Already running" );
2 Answers
Related