- 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.
- HornetQ Messaging Developer’s Guide
- Learning Cython Programming
- Android和PHP開發最佳實踐(第2版)
- PHP+MySQL網站開發技術項目式教程(第2版)
- C#程序設計教程
- Cassandra Design Patterns(Second Edition)
- 零基礎學單片機C語言程序設計
- NetBeans IDE 8 Cookbook
- 新一代SDN:VMware NSX 網絡原理與實踐
- Python圖形化編程(微課版)
- Java并發編程之美
- 平面設計經典案例教程:CorelDRAW X6
- 從0到1:HTML5 Canvas動畫開發
- Kohana 3.0 Beginner's Guide
- 程序員面試金典(第6版)