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

Allow both assignment and new variable declarations in the same deconstruction #24116

Closed
3 tasks done
BillWagner opened this issue May 10, 2021 · 0 comments · Fixed by #24928
Closed
3 tasks done

Allow both assignment and new variable declarations in the same deconstruction #24116

BillWagner opened this issue May 10, 2021 · 0 comments · Fixed by #24928
Assignees
Labels
doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3

Comments

@BillWagner
Copy link
Member

BillWagner commented May 10, 2021

Mix declaration and assignment in deconstruction

Currently the left side of a deconstruction must be either all variable declarations, or assignments to existing variables (or a discard). This would allow a mix of declarations and variables on the left side.

  • Update deconstruction language reference article.
  • Check tuple article for potential examples.
  • Check for other deconstruction examples that could be updated.
@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label May 10, 2021
@BillWagner BillWagner added doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 and removed Pri3 labels May 10, 2021
@BillWagner BillWagner changed the title [Mix declaration and assignment in deconstruction](https://github.com/dotnet/csharplang/issues/125) Allow both assignment and new variable declarations in the same deconstruction May 11, 2021
@BillWagner BillWagner removed the ⌚ Not Triaged Not triaged label May 11, 2021
@BillWagner BillWagner self-assigned this Jun 8, 2021
BillWagner added a commit to BillWagner/docs that referenced this issue Jun 30, 2021
Fixes dotnet#24116

Beginning with C# 10, the left side of a deconstruction can mix variable assignment and variable initialization.

With this PR, I searched for all instances of "deconstruct" to see if they referenced the previous restriction. Only one instance made that declaration.

Update the "deconstruct" article to add a new samples that shows the new syntax.
BillWagner added a commit that referenced this issue Jul 1, 2021
* deconstruction allows assignment and initialization

Fixes #24116

Beginning with C# 10, the left side of a deconstruction can mix variable assignment and variable initialization.

With this PR, I searched for all instances of "deconstruct" to see if they referenced the previous restriction. Only one instance made that declaration.

Update the "deconstruct" article to add a new samples that shows the new syntax.

* fix build warnings.
Youssef1313 pushed a commit to Youssef1313/docs that referenced this issue Jul 5, 2021
* deconstruction allows assignment and initialization

Fixes dotnet#24116

Beginning with C# 10, the left side of a deconstruction can mix variable assignment and variable initialization.

With this PR, I searched for all instances of "deconstruct" to see if they referenced the previous restriction. Only one instance made that declaration.

Update the "deconstruct" article to add a new samples that shows the new syntax.

* fix build warnings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants