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

Initializing a collection of integers to their array and displaying the results

Now, double-click on the Display Values button and go into Default.aspx.cs. Delete the Page_Load block. Next, between the set of curly braces beneath the line beginning with protected void Button1_Click..., enter the following:

GenericsClass<int> ints = new GenericsClass<int>(new int[] { 1, 2, 3, 4, 5 });

You can see in this line that we are basically initializing a collection of integers to their array.

Now, you can display this. So, for example, you can enter the following below this line:

sampLabel.Text += ints.DisplayValues();

Notice that the GenericsClass which we have constructed is operating in integers, but it can operate equally well on any other data type.

主站蜘蛛池模板: 临桂县| 社会| 雷州市| 崇信县| 剑阁县| 库尔勒市| 黔西| 溧阳市| 小金县| 双鸭山市| 都安| 恩平市| 宁河县| 洞口县| 嘉峪关市| 闻喜县| 邵阳县| 囊谦县| 托克托县| 南昌市| 长葛市| 台州市| 东兴市| 定西市| 阿合奇县| 柳河县| 保定市| 登封市| 福州市| 拜泉县| 广灵县| 龙江县| 庆城县| 遂溪县| 宜丰县| 扎兰屯市| 申扎县| 娄底市| 慈利县| 东宁县| 甘肃省|