- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 118字
- 2021-07-02 15:29:14
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.
推薦閱讀
- The DevOps 2.3 Toolkit
- Spring 5.0 By Example
- Visual C++串口通信開發入門與編程實踐
- Java 9 Concurrency Cookbook(Second Edition)
- Android開發精要
- jQuery開發基礎教程
- Unity 2D Game Development Cookbook
- Java EE核心技術與應用
- C# Multithreaded and Parallel Programming
- R語言:邁向大數據之路(加強版)
- 單片機原理及應用技術
- Visual Basic程序設計全程指南
- Web編程基礎:HTML5、CSS3、JavaScript(第2版)
- Flask開發Web搜索引擎入門與實戰
- 用Python動手學統計學