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

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.

主站蜘蛛池模板: 赤壁市| 罗定市| 自贡市| 微博| 玉树县| 绥江县| 万载县| 绍兴县| 桃园市| 九龙城区| 丹凤县| 剑河县| 咸阳市| 嘉善县| 阜康市| 荆门市| 晋城| 平塘县| 平遥县| 漠河县| 玉林市| 增城市| 泽普县| 敖汉旗| 墨脱县| 闵行区| 湄潭县| 延庆县| 中阳县| 二连浩特市| 浦县| 澄城县| 庆城县| 那曲县| 新晃| 福贡县| 西乌珠穆沁旗| 东丰县| 石狮市| 福清市| 太原市|