- 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數據庫從入門到運維實戰
- Mastering C# Concurrency
- Cassandra Data Modeling and Analysis
- 秒懂設計模式
- JS全書:JavaScript Web前端開發指南
- 計算機應用基礎實踐教程
- 基于ARM Cortex-M4F內核的MSP432 MCU開發實踐
- RESTful Java Web Services(Second Edition)
- Learning iOS Security
- 超簡單:Photoshop+JavaScript+Python智能修圖與圖像自動化處理
- DevOps 精要:業務視角
- Joomla!Search Engine Optimization
- 軟件測試技術
- SaaS攻略:入門、實戰與進階
- JavaScript語法簡明手冊