We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version Used: C# 8
At the moment the following is not possible:
return list.Count switch { 0 => null, 1 => list[0], _ => { LogError(); return null; } };
I get Invalid expression term '{'
The obvious workaround here is defining a quick little private function.
The text was updated successfully, but these errors were encountered:
Duplicate of #3037.
Sorry, something went wrong.
I think this is covered by the more general expression blocks proposal: #3086.
With that, your example would be:
return list.Count switch { 0 => null, 1 => list[0], _ => { LogError(); null } };
It would be, yes, but this issue was specifically about switch expressions, unlike the general block expression proposal.
No branches or pull requests
Version Used: C# 8
At the moment the following is not possible:
I get Invalid expression term '{'
The obvious workaround here is defining a quick little private function.
The text was updated successfully, but these errors were encountered: