- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 306字
- 2021-07-02 15:29:26
Running the program
What you have here is very sophisticated code. Now crank it up in your browser, and take a look at the results. Enter some values, say 1,5, and -3, and click on the Find Max button. The result is 5, as you can see in Figure 7.2.3:

Next, enter something such as 1.01, 1.02, and 0.9999, and click on the Find Max button. The result is 1.02, as you can see in Figure 7.2.4:

So, the program is working as expected.
Again, to review, because there's a lot of code here, we did the following in this program:
- First, we declared a delegate.
- Then we declared an expression-bodied member, which, in this context of this code, is a function that's defined essentially with a Lambda.
- Next, we made an array of values.
- Then we created a line to convert the values from a string type to a double type.
- After that, we made an expression-bodied Lambda.
- Then we built a function called CompareValuesInList that takes that Lambda as an argument and then also looks at the other values.
- Finally, CompareValuesInList is where the magic really happens, because it says that, if the third value is bigger than either of the two first compared, then you return the third value. However, if it's not, then simply return the one that is the bigger of the first two.
I know this doesn't seem like an easy thing to do. I know this because I've done this before. You must absolutely add this level of coding, however. Type it, run it, and process it; then you will develop your understanding quickly enough. These are the fundamentals of making some of this stuff useful.
- Oracle從入門到精通(第3版)
- FuelPHP Application Development Blueprints
- SpringMVC+MyBatis快速開發與項目實戰
- Java面向對象思想與程序設計
- Three.js開發指南:基于WebGL和HTML5在網頁上渲染3D圖形和動畫(原書第3版)
- 區塊鏈:以太坊DApp開發實戰
- C語言程序設計教程
- Creating Data Stories with Tableau Public
- Cocos2d-x by Example:Beginner's Guide(Second Edition)
- 微課學人工智能Python編程
- 玩轉.NET Micro Framework移植:基于STM32F10x處理器
- Hack與HHVM權威指南
- Android智能手機APP界面設計實戰教程
- jQuery Mobile Web Development Essentials(Second Edition)
- C++標準庫(第2版)