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

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.

主站蜘蛛池模板: 贵溪市| 得荣县| 肥西县| 石台县| 崇文区| 固阳县| 梁河县| 龙门县| 神池县| 梅州市| 门头沟区| 德令哈市| 西昌市| 济南市| 彰武县| 松潘县| 河北区| 霍山县| 康乐县| 龙陵县| 尼勒克县| 遂川县| 越西县| 万源市| 新营市| 酉阳| 芦溪县| 兰考县| 屏山县| 通榆县| 漯河市| 鹿邑县| 夏津县| 增城市| 北宁市| 昌江| 佛学| 正定县| 孙吴县| 前郭尔| 梅州市|