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

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.

主站蜘蛛池模板: 巨野县| 昭觉县| 连平县| 滨州市| 绥江县| 屯昌县| 万源市| 广河县| 绥芬河市| 淮阳县| 来安县| 阿克陶县| 达孜县| 石嘴山市| 连南| 习水县| 建始县| 沛县| 杭锦后旗| 德格县| 明溪县| 乌什县| 新野县| 商洛市| 鄂州市| 扶绥县| 阳新县| 邛崃市| 昔阳县| 永州市| 冕宁县| 日土县| 晋江市| 建平县| 连城县| 茂名市| 永仁县| 临潭县| 聂荣县| 名山县| 忻城县|