Re:What's New in C# 14: Null-Conditional Assignments
by tekdude on Wednesday September 17, 2025 @10:10PM
(#45284240)
I wonder if this supports a cleaner way to throw when the target property's parent object is null? With null-coalescing assignment, you can do the following which will throw when 'x' is null:
It would be interesting to try something like:
But I don't know how the language would be able to determine which potential null it was throwing for: 'customer' could be null, but so could 'newName'. I guess... maybe you could do:
But the language already supports that, and it's extremely ugly...
[ Parent
| on HN ]
There are no comments on this comment yet.