- C# 7 and .NET Core Cookbook
- Dirk Strauss
- 117字
- 2021-07-03 00:11:51
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.
推薦閱讀
- .NET之美:.NET關(guān)鍵技術(shù)深入解析
- Python從菜鳥(niǎo)到高手(第2版)
- Learning Firefox OS Application Development
- MySQL數(shù)據(jù)庫(kù)管理與開(kāi)發(fā)實(shí)踐教程 (清華電腦學(xué)堂)
- 精通Python設(shè)計(jì)模式(第2版)
- Python算法從菜鳥(niǎo)到達(dá)人
- Python Essentials
- C語(yǔ)言程序設(shè)計(jì)簡(jiǎn)明教程:Qt實(shí)戰(zhàn)
- 你真的會(huì)寫(xiě)代碼嗎
- React and React Native
- Cloud Development andDeployment with CloudBees
- Internet of Things with Arduino Cookbook
- C#開(kāi)發(fā)之道
- Java EE 7 First Look
- C語(yǔ)言程序設(shè)計(jì)