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

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.

主站蜘蛛池模板: 海城市| 黄浦区| 孙吴县| 江津市| 北安市| 福贡县| 南部县| 广东省| 竹北市| 彝良县| 长垣县| 武安市| 麻栗坡县| 铜山县| 拜城县| 新源县| 崇明县| 郎溪县| 盐池县| 和硕县| 广平县| 大庆市| 桃江县| 青龙| 临猗县| 蛟河市| 永川市| 宝坻区| 弋阳县| 清远市| 资源县| 五家渠市| 金阳县| 富宁县| 长海县| 两当县| 贡觉县| 儋州市| 分宜县| 曲沃县| 安宁市|