- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 164字
- 2021-07-02 15:29:17
Modifying the program for an additional type of comparison
Now, go back to Default.aspx and, in the next stage, in the Design view, we will also compare those values. For this, double-click on the Exchange and Compare button again and add the following beneath the last line we entered:
sampLabel.Text += GenMethods.Compare<double>(x, y);
Remember that the way we designed Compare, it returns a string that returns one of the two values, depending on the specifics. So, in this line we will compare double; so you put that in there and then the two values will be x, y.
Let's give it a shot in your browser. Click on the Exchange and Compare button once again. The new results are shown in Figure 2.2.5:

Figure 2.2.5: Results of the modified program run
Now, x is 25 and y is 34. When you exchange the values, x is 34 and y is 25. Further, 34 is certainly more than 25. It looks really nice and professional.
推薦閱讀
- Vue.js 3.x快速入門
- Object-Oriented JavaScript(Second Edition)
- Python神經網絡項目實戰
- R的極客理想:工具篇
- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- SharePoint Development with the SharePoint Framework
- R Deep Learning Cookbook
- Scala程序員面試算法寶典
- Spring+Spring MVC+MyBatis從零開始學
- Building Serverless Web Applications
- Xamarin Blueprints
- Instant Apache Camel Messaging System
- Java設計模式深入研究
- Microsoft XNA 4.0 Game Development Cookbook
- C/C++程序設計教程