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

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.

主站蜘蛛池模板: 北票市| 肇州县| 云浮市| 巩义市| 泾阳县| 马龙县| 乐安县| 榆树市| 四子王旗| 泽普县| 冷水江市| 宁安市| 延边| 福泉市| 梁山县| 淮南市| 乌鲁木齐市| 关岭| 德庆县| 河间市| 中江县| 夏邑县| 陕西省| 来宾市| 河北区| 开封市| 丹凤县| 榆社县| 从江县| 二手房| 漳浦县| 济源市| 武汉市| 沙洋县| 西峡县| 宁远县| 乳源| 新绛县| 高清| 屏东市| 邮箱|