官术网_书友最值得收藏!

How it works...

Tuples are structs, and therefore value types that are created locally. You, therefore, do not have to worry about using and assigning Tuples on-the-fly or that it creating a lot of allocations. Their contents are merely copied when passed. Tuples are mutable and the elements are publicly scoped mutable fields. Using the code example in this recipe, I can, therefore, do the following:

returnTuple = (returnTuple.ave + 15, returnTuple.sCount - 1);

C# 7.0 is allowing me to first update the average value (shifting the average up) and then decrementing the count field. Tuples are a very powerful feature of C# 7.0, and it will be of great benefit to many developers when implemented it correctly.

主站蜘蛛池模板: 台东县| 岫岩| 闽清县| 泰安市| 九龙县| 永靖县| 溧阳市| 和静县| 固镇县| 陇南市| 肥东县| 平远县| 泸溪县| 望都县| 岚皋县| 舒城县| 湘阴县| 大悟县| 小金县| 石泉县| 南江县| 会同县| 沅江市| 滁州市| 晋城| 台湾省| 铜川市| 辽阳县| 沁水县| 玛曲县| 莱芜市| 阜新| 永修县| 神池县| 黄龙县| 平谷区| 无棣县| 黎川县| 阿拉善左旗| 泗阳县| 顺义区|