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

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.

主站蜘蛛池模板: 寿光市| 行唐县| 金湖县| 桃园市| 深水埗区| 康马县| 中江县| 嘉祥县| 邹平县| 来安县| 永寿县| 布尔津县| 乐业县| 扬州市| 富源县| 梁山县| 昌江| 合阳县| 奉贤区| 清苑县| 雷波县| 陆丰市| 乐亭县| 会理县| 铜川市| 寿宁县| 防城港市| 云霄县| 宜章县| 井研县| 呼图壁县| 林口县| 师宗县| 油尖旺区| 青冈县| 烟台市| 探索| 新密市| 水城县| 德江县| 朝阳区|