- 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.
- 國(guó)際大學(xué)生程序設(shè)計(jì)競(jìng)賽中山大學(xué)內(nèi)部選拔真題解(二)
- vSphere High Performance Cookbook
- INSTANT MinGW Starter
- 數(shù)據(jù)結(jié)構(gòu)與算法JavaScript描述
- 從0到1:HTML+CSS快速上手
- SQL Server 2012數(shù)據(jù)庫(kù)管理與開(kāi)發(fā)項(xiàng)目教程
- 微信小程序項(xiàng)目開(kāi)發(fā)實(shí)戰(zhàn)
- 零基礎(chǔ)Java學(xué)習(xí)筆記
- “笨辦法”學(xué)C語(yǔ)言
- R數(shù)據(jù)科學(xué)實(shí)戰(zhàn):工具詳解與案例分析
- Java并發(fā)編程之美
- Zabbix Performance Tuning
- 單片機(jī)原理及應(yīng)用技術(shù)
- Python 3 Object:oriented Programming(Second Edition)
- Spring Boot學(xué)習(xí)指南:構(gòu)建云原生Java和Kotlin應(yīng)用程序