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

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();
}
}
主站蜘蛛池模板: 洛扎县| 英吉沙县| 依兰县| 江川县| 贵港市| 玛纳斯县| 华坪县| 怀集县| 威海市| 静安区| 平泉县| 城步| 兴文县| 湖南省| 塔城市| 石门县| 阜阳市| 平顺县| 宁明县| 石台县| 堆龙德庆县| 盐亭县| 乌兰察布市| 安康市| 延吉市| 江口县| SHOW| 西城区| 龙江县| 太保市| 嫩江县| 枝江市| 河北区| 辽阳县| 淮滨县| 湘潭市| 大冶市| 仲巴县| 柳林县| 虎林市| 奈曼旗|