Skip to content
New issue

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

Shorter method to change null value #2743

Closed
frodegil opened this issue Aug 24, 2019 · 2 comments
Closed

Shorter method to change null value #2743

frodegil opened this issue Aug 24, 2019 · 2 comments

Comments

@frodegil
Copy link

Hi C# team

Instead of

nullableVariable = nullableVariable ?? "Default non-null value";

it would be nice to just use a short-circuit

nullableVariable ??= "Default non-null value";

@svick
Copy link
Contributor

svick commented Aug 24, 2019

That code is already valid in the current C# 8.0 preview and so it should work in the final version of C# 8.0, which is planned to be released next month.

For more details, see #34.

@YairHalberstadt
Copy link
Contributor

Closing as implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants