- C# 7 and .NET Core Cookbook
- Dirk Strauss
- 110字
- 2021-07-03 00:11:52
Getting ready
Remember when we used Tuples at the beginning of this chapter? Well we were using code similar to the following to get the values returned by the Tuple literal.
var (average, studentCount) = ch1.GetAverageAndCount(scores);
This was deconstructing the parts of the Tuple into the new variables average and studentCount. I do not, however, want to take a look at Tuples again. What I want to do is show how you can implement a deconstruction declaration on any type. To do this, all that we need to do is ensure that the type has a deconstructor method. We will modify our existing Student class to add a deconstructor.
推薦閱讀
- DB2 V9權威指南
- LabVIEW程序設計基礎與應用
- 人人都懂設計模式:從生活中領悟設計模式(Python實現)
- Kotlin從基礎到實戰
- Python Data Analysis Cookbook
- Web Development with MongoDB and Node(Third Edition)
- 單片機C語言程序設計實訓100例
- Linux Shell核心編程指南
- C#開發案例精粹
- Java Web從入門到精通(第3版)
- 深度探索Go語言:對象模型與runtime的原理特性及應用
- 計算機應用技能實訓教程
- Learning VMware vSphere
- Web程序設計:ASP.NET(第2版)
- MySQL 8從零開始學(視頻教學版)