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

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();
}
}
主站蜘蛛池模板: 同江市| 长白| 涡阳县| 盖州市| 和田市| 安阳市| 清苑县| 宜昌市| 镇沅| 香河县| 宁德市| 永德县| 皋兰县| 巴马| 赤城县| 镇安县| 略阳县| 措美县| 彭阳县| 梨树县| 融水| 锦屏县| 新晃| 九龙县| 孟村| 神木县| 剑河县| 昌乐县| 京山县| 大关县| 武冈市| 商城县| 霍林郭勒市| 北票市| 乌鲁木齐县| 三穗县| 沿河| 康定县| 安康市| 庆安县| 名山县|