- 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();
}
}
推薦閱讀
- DevOps with Kubernetes
- Flask Blueprints
- Hyper-V 2016 Best Practices
- Node.js Design Patterns
- Java應(yīng)用開發(fā)與實(shí)踐
- Python Tools for Visual Studio
- 數(shù)據(jù)結(jié)構(gòu)與算法JavaScript描述
- Hadoop+Spark大數(shù)據(jù)分析實(shí)戰(zhàn)
- Linux操作系統(tǒng)基礎(chǔ)案例教程
- 精通Python設(shè)計(jì)模式(第2版)
- Mastering ServiceNow(Second Edition)
- TradeStation交易應(yīng)用實(shí)踐:量化方法構(gòu)建贏家策略(原書第2版)
- 微信小程序入門指南
- 從程序員角度學(xué)習(xí)數(shù)據(jù)庫技術(shù)(藍(lán)橋杯軟件大賽培訓(xùn)教材-Java方向)
- Learning Ionic