c# multi assignment

后端 未结 7 1786
温柔的废话
温柔的废话 2020-12-16 13:54
int a, b, n;
...
(a, b) = (2, 3);
// \'a\' is now 2 and \'b\' is now 3

This sort of thing would be really helpfull in C#. In this example \'a\' and

7条回答
  •  独厮守ぢ
    2020-12-16 14:20

    Deconstruction was introduced in C# 7.0: https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/#user-content-deconstruction

提交回复
热议问题