- 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.
推薦閱讀
- C++面向?qū)ο蟪绦蛟O(shè)計(jì)(第三版)
- Learning Chef
- Python Game Programming By Example
- Flash CS6中文版應(yīng)用教程(第三版)
- 網(wǎng)絡(luò)爬蟲原理與實(shí)踐:基于C#語(yǔ)言
- Linux Device Drivers Development
- 編寫高質(zhì)量代碼:改善Objective-C程序的61個(gè)建議
- 案例式C語(yǔ)言程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo)
- Java 9 Programming By Example
- 視窗軟件設(shè)計(jì)和開發(fā)自動(dòng)化:可視化D++語(yǔ)言
- 大規(guī)模語(yǔ)言模型開發(fā)基礎(chǔ)與實(shí)踐
- Groovy 2 Cookbook
- C Primer Plus(第6版)中文版【最新修訂版】
- Three.js Essentials
- Slick2D Game Development