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

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();
}
}
主站蜘蛛池模板: 图木舒克市| 连山| 体育| 岗巴县| 宣化县| 五莲县| 山阳县| 文化| 阿拉善左旗| 海南省| 沧源| 体育| 靖远县| 海兴县| 克拉玛依市| 新余市| 内江市| 博罗县| 玉树县| 五大连池市| 黑山县| 阜新| 德昌县| 巴青县| 东明县| 巴彦淖尔市| 大兴区| 永昌县| 内乡县| 韶关市| 永嘉县| 尉犁县| 麻城市| 军事| 云浮市| 白沙| 大余县| 广元市| 永宁县| 正镶白旗| 东安县|