Proposal: null-propagating with
syntax
#6575
Replies: 3 comments 11 replies
-
The syntax choice will be affected if |
Beta Was this translation helpful? Give feedback.
-
I could really use return state with
{
SomeDialog = state.SomeDialog is null ? null : state.SomeDialog with
{
SomeTextBox = state.SomeDialog.SomeTextBox with { Value = newValue },
},
}; I'd like to be able to write this instead: return state with
{
SomeDialog = state.SomeDialog with?
{
SomeTextBox = state.SomeDialog.SomeTextBox with { Value = newValue },
},
}; I also want to be able to collapse this structure like #4587 specifies, but with return state with { SomeDialog?.SomeTextBox.Value = newValue }; |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Pretty straightforward proposal, a natural extension of the existing functionality, and (I assume) fairly low-cost.
I imagine the most natural syntax looks like
or possibly
Beta Was this translation helpful? Give feedback.
All reactions