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

Null conditional assignment operator #9529

Closed
UnoSD opened this issue Mar 7, 2016 · 1 comment
Closed

Null conditional assignment operator #9529

UnoSD opened this issue Mar 7, 2016 · 1 comment
Labels
Area-Language Design Resolution-Duplicate The described behavior is tracked in another issue

Comments

@UnoSD
Copy link

UnoSD commented Mar 7, 2016

Please consider this enhancement:

Any version:

Null conditional assignment:

Would be nice to have an operator to assign a value just when it's null:

    // If values is null, execute statement on the right and assign.
    values ?= new List<string>();

    // Instead of:
    if(values == null) values = new List<string>();

    // Or even worse:
    values = values ?? (values = new List<string>());
@bbarry
Copy link

bbarry commented Mar 7, 2016

#205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Language Design Resolution-Duplicate The described behavior is tracked in another issue
Projects
None yet
Development

No branches or pull requests

4 participants