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

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.

主站蜘蛛池模板: 九江市| 商河县| 施秉县| 股票| 聂荣县| 韶山市| 玉屏| 靖州| 威远县| 吉首市| 永春县| 黔西县| 鄂托克前旗| 正定县| 遂昌县| 田林县| 达孜县| 成安县| 灵台县| 乐清市| 宝丰县| 海林市| 商水县| 柳州市| 防城港市| 黄平县| 三原县| 夹江县| 宾阳县| 巴中市| 常山县| 遂平县| 浦东新区| 德安县| 个旧市| 东乡族自治县| 巴林右旗| 青阳县| 镇原县| 阳江市| 芦溪县|