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

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.

主站蜘蛛池模板: 万全县| 阿克苏市| 武夷山市| 武山县| 疏附县| 沂南县| 永年县| 崇阳县| 桂林市| 乐东| 金门县| 措美县| 陆丰市| 天门市| 中西区| 雷州市| 高唐县| 陕西省| 建阳市| 资中县| 桂林市| 东兰县| 拜城县| 桑植县| 乌鲁木齐县| 康平县| 义乌市| 余姚市| 永济市| 南投县| 普宁市| 舒城县| 铜山县| 镇坪县| 柘城县| 化州市| 阜阳市| 镇赉县| 伊川县| 绍兴市| 望都县|