Conditional not-null assignment operator #9660
Replies: 3 comments 3 replies
-
Is I'd also add (and I mean this in the nicest possible way) that if teammates find the existing way of |
Beta Was this translation helpful? Give feedback.
-
already
|
Beta Was this translation helpful? Give feedback.
-
may be try use this or more evil like this |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be nice to have an operator to simplify object field filling for PATCH purposes. For example, I have hundreds of lines where I need to check if the target parameter received from the client
It should return the value of the right-hand operand if it isn't null (exists)
for example, AI suggests that Ruby has at least two ways to check value
while the most compact option that C# allows is
And it doesn't look good and raises questions from teammates, like why do we have to assign x with the same value if
value
is null?It would be nice to have some syntax sugar like
the way similar to the null-coalescing assignment operator
??=
provided in C# 8.0or maybe someone can provide a good example of how to do it without extra overhead and code spaghetti
Beta Was this translation helpful? Give feedback.
All reactions