如何到具体项目中的IEnumerable具体、项目、IEnumerable

由网友(抹不掉的青春的序言*)分享简介:我的IEnumerable,其中包含它里面的一些数据。I have IEnumerable which contains number Data inside it.修改该IEnumerable的距离System.Collection.Ienumerable指令。EditThe IEnumerable is f...

我的IEnumerable,其中包含它里面的一些数据。

I have IEnumerable which contains number Data inside it.

修改 该IEnumerable的距离System.Collection.Ienumerable指令。

Edit The IEnumerable is from System.Collection.Ienumerable directive.

附Viual工作室,枚举包含数据的快照:

Attached the snapShot of Viual Studio, Enum that Contains Data:

只是简单地介绍关于上面的图片,eLevelData是的IEnumerable 变量,在此我有我的数据。

Just to brief about the above image, eLevelData is the IEnumerable variable, in which I have my data .

现在我想去数据索引4或5,但我不希望使用foreach循环。任何建议请。

Now I want to go to the data at index 4 or 5, but I don't want to use foreach loop. Any suggestions please.

谢谢

Subhen

推荐答案

VAR项目= eLevelData.ElementAt(指数);

如果您的收藏类型为的IEnumerable 而不是的IEnumerable< T> 则需要使用之前,你可以打电话投的ElementAt 扩展方法,如:

If your collection is typed as IEnumerable instead of IEnumerable<T> you'll need to use the Cast extension method before you can call ElementAt e.g.

VAR项目= eLevelData.Cast&LT; RMSRequestProcessor.RMSMedia&GT;()的ElementAt(指数)

阅读全文

相关推荐

最新文章