- 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.
推薦閱讀
- Django+Vue.js商城項(xiàng)目實(shí)戰(zhàn)
- Programming ArcGIS 10.1 with Python Cookbook
- Apache Spark Graph Processing
- 新手學(xué)Visual C# 2008程序設(shè)計(jì)
- Python自然語言處理(微課版)
- 程序是怎樣跑起來的(第3版)
- SQL Server與JSP動態(tài)網(wǎng)站開發(fā)
- Mastering Business Intelligence with MicroStrategy
- ElasticSearch Cookbook(Second Edition)
- 匯編語言編程基礎(chǔ):基于LoongArch
- Scala for Machine Learning(Second Edition)
- Go語言開發(fā)實(shí)戰(zhàn)(慕課版)
- 網(wǎng)絡(luò)數(shù)據(jù)采集技術(shù):Java網(wǎng)絡(luò)爬蟲實(shí)戰(zhàn)
- 深度實(shí)踐KVM:核心技術(shù)、管理運(yùn)維、性能優(yōu)化與項(xiàng)目實(shí)施
- C語言程序設(shè)計(jì)教程