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

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.

主站蜘蛛池模板: 龙里县| 黎城县| 嘉峪关市| 得荣县| 宁南县| 鄂托克前旗| 哈密市| 锡林郭勒盟| 平原县| 万源市| 雷山县| 赤水市| 沾益县| 察雅县| 桓台县| 威信县| 蕉岭县| 封开县| 仁化县| 大邑县| 钟祥市| 邵东县| 邳州市| 乌苏市| 绵阳市| 如皋市| 象州县| 和顺县| 贺州市| 阿坝县| 舒兰市| 监利县| 遵化市| 韶关市| 永仁县| 新乐市| 东乡县| 普格县| 丰宁| 睢宁县| 郴州市|