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

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.

主站蜘蛛池模板: 五大连池市| 平昌县| 甘谷县| 乐清市| 正蓝旗| 大兴区| 塘沽区| 涪陵区| 夏邑县| 绥宁县| 和林格尔县| 平罗县| 富民县| 丹阳市| 清水河县| 吉木乃县| 临夏县| 封丘县| 镶黄旗| 广东省| 鹿泉市| 沂南县| 日土县| 怀远县| 平武县| 喀喇沁旗| 珠海市| 揭东县| 大英县| 留坝县| 荆州市| 富阳市| 若尔盖县| 观塘区| 连城县| 汝阳县| 会理县| 芒康县| 武清区| 富蕴县| 区。|