- 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.
推薦閱讀
- JBoss Weld CDI for Java Platform
- Progressive Web Apps with React
- 造個小程序:與微信一起干件正經(jīng)事兒
- Dependency Injection in .NET Core 2.0
- Scala謎題
- INSTANT OpenNMS Starter
- 大學(xué)計算機(jī)基礎(chǔ)(第2版)(微課版)
- 低代碼平臺開發(fā)實(shí)踐:基于React
- Programming with CodeIgniterMVC
- Azure Serverless Computing Cookbook
- HoloLens與混合現(xiàn)實(shí)開發(fā)
- Python編程:從入門到實(shí)踐(第3版)
- Python預(yù)測分析實(shí)戰(zhàn)
- Drupal 8 Development Cookbook(Second Edition)
- 網(wǎng)頁設(shè)計與制作