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

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.

主站蜘蛛池模板: 岗巴县| 内丘县| 兰西县| 阿勒泰市| 姚安县| 建宁县| 运城市| 昭觉县| 商水县| 南宫市| 城口县| 德州市| 东丰县| 诏安县| 攀枝花市| 潮州市| 阳曲县| 修武县| 清徐县| 茌平县| 古丈县| 武清区| 益阳市| 靖州| 秭归县| 文山县| 五大连池市| 榆中县| 额敏县| 托克逊县| 灵石县| 临漳县| 陕西省| 新河县| 唐海县| 门源| 博野县| 洛扎县| 牟定县| 清丰县| 东海县|