官术网_书友最值得收藏!

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&lt;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();
}
}
主站蜘蛛池模板: 米易县| 调兵山市| 九龙坡区| 清流县| 营口市| 望江县| 黔东| 盈江县| 金堂县| 洛宁县| 溧阳市| 云阳县| 长治市| 安岳县| 永州市| 高青县| 宁河县| 年辖:市辖区| 纳雍县| 介休市| 徐汇区| 子长县| 胶南市| 米脂县| 萝北县| 益阳市| 淳安县| 定安县| 思南县| 北川| 长乐市| 安仁县| 休宁县| 清流县| 蚌埠市| 武平县| 高淳县| 新乡市| 景德镇市| 泉州市| 桓仁|