- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 162字
- 2021-07-02 15:29:15
Chapter review
For review, the complete version of the Default.aspx.cs file for this chapter, including comments, is shown in the following code block:
//using is a directive
//System is a name space
//name space is a collection of features that our needs to run
using System;
//public means accessible anywhere
//partial means this class is split over multiple files
//class is a keyword and think of it as the outermost level of grouping
//:System.Web.UI.Page means our page inherits the features of a Page
public partial class _Default : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
//in each case below, GenericsClass<...> works equally well with
//integers, doubles and decimals, among others
GenericsClass<int> ints = new GenericsClass<int>(new int[] { 1, 2, 3, 4, 5 });
sampLabel.Text = ints.DisplayValues();
GenericsClass<double> dubs = new GenericsClass<double>(new double[] { 1.0, -2.3, 3, 4, 5 });
sampLabel.Text += ints.DisplayValues();
GenericsClass<decimal> decs = new GenericsClass<decimal>(new decimal[] { 1, 2.0M, 3, 4, 5.79M });
sampLabel.Text += decs.DisplayValues();
}
}
推薦閱讀
- Oracle Exadata性能優(yōu)化
- Mastering Selenium WebDriver
- 認(rèn)識(shí)編程:以Python語(yǔ)言講透編程的本質(zhì)
- Hands-On Data Structures and Algorithms with JavaScript
- Redis Essentials
- QGIS By Example
- 用戶體驗(yàn)增長(zhǎng):數(shù)字化·智能化·綠色化
- Learning Concurrency in Kotlin
- Visualforce Developer’s guide
- Java SE實(shí)踐教程
- Java程序員面試筆試寶典(第2版)
- Python函數(shù)式編程(第2版)
- Flink技術(shù)內(nèi)幕:架構(gòu)設(shè)計(jì)與實(shí)現(xiàn)原理
- Oracle 12c從入門(mén)到精通(視頻教學(xué)超值版)
- Arduino機(jī)器人系統(tǒng)設(shè)計(jì)及開(kāi)發(fā)