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

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.

主站蜘蛛池模板: 广元市| 托克逊县| 宝鸡市| 蒲城县| 墨玉县| 铅山县| 镇沅| 平罗县| 灯塔市| 深泽县| 青铜峡市| 宁晋县| 玉门市| 阿拉善左旗| 揭东县| 沛县| 富平县| 聊城市| 曲麻莱县| 亳州市| 安顺市| 台东县| 兰考县| 丰台区| 建湖县| 泗阳县| 马尔康县| 水城县| 高雄市| 荣昌县| 澄江县| 蒲城县| 皮山县| 冷水江市| 凭祥市| 栾川县| 景泰县| 泸州市| 延寿县| 栾川县| SHOW|