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

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.

主站蜘蛛池模板: 昭平县| 新昌县| 双峰县| 镇赉县| 文登市| 宝兴县| 洛南县| 长治县| 巍山| 元阳县| 康马县| 堆龙德庆县| 磴口县| 阿城市| 闸北区| 湘潭市| 新昌县| 甘洛县| 湖口县| 元江| 黄冈市| 祁连县| 贵定县| 凤凰县| 清新县| 安图县| 大冶市| 通化市| 宁南县| 莫力| 东乡| 无锡市| 田东县| 华坪县| 伊春市| 晋宁县| 乌鲁木齐市| 滨州市| 理塘县| 兴国县| 富顺县|