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

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.

主站蜘蛛池模板: 理塘县| 蒙自县| 临沂市| 嘉义市| 天全县| 尚义县| 团风县| 新乡市| 繁昌县| 保定市| 筠连县| 崇州市| 苍梧县| 福安市| 伊宁县| 贵阳市| 灌云县| 金沙县| 呼玛县| 新营市| 县级市| 图木舒克市| 迭部县| 邵阳市| 双峰县| 巴南区| 永年县| 博白县| 天峻县| 泽州县| 莆田市| 杨浦区| 玉环县| 韶关市| 易门县| 西城区| 株洲县| 奉节县| 漯河市| 鹤峰县| 谷城县|