As I upgraded my Visual Studio 2022 Preview, I noticed a new code suggestion: IDE0180
. It popped next to a reasonably standard variable swap:
Old swap codevar tmp = a;
a = b;
b = tmp;
The new syntax it recommended was much nicer, in my opinion:
New swap code(a, b) = (b, a);
I love the new syntax!
Except it's not new - it has been available since C# 7 (we're at 10 now, just for reference). I just somehow missed it. The only reason I noticed it now was due to a suggestion. I guess better late than never. :)