- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 159字
- 2021-07-02 15:29:28
Working with the IEnumerable generic interface
Next, in between the set of curly braces beneath the line beginning with protected void Button1_Click..., the first thing that we will do is create an array of names. For this, enter the following:
IEnumerable<string> names = new string[] { "john", "job", "janet", "mary", "steve" };
Let's name it names, and then say, create a new string array. Then, to specify the initializer list, we enter a series of names in quotes, and close this with a semicolon.
Now notice that, on the left-hand side, we have IEnumerable. This is a generic interface. As you can see, the new string array in this line can be created this way because it's possible to take an array then step through it, so that each entry inside the array is a string. So, it's IEnumerable: we can list values within it, and each value to be listed is a string. To enumerate means to list.
- UNIX編程藝術
- Vue.js 3.x快速入門
- 計算思維與算法入門
- C/C++算法從菜鳥到達人
- HTML5+CSS3基礎開發教程(第2版)
- C程序設計案例教程
- Visual C++開發入行真功夫
- 微服務從小白到專家:Spring Cloud和Kubernetes實戰
- Babylon.js Essentials
- 現代C++編程實戰:132個核心技巧示例(原書第2版)
- Angular Design Patterns
- Web編程基礎:HTML5、CSS3、JavaScript(第2版)
- Python機器學習開發實戰
- Python Linux系統管理與自動化運維
- Building Clouds with Windows Azure Pack