How to go to particular Item in IEnumerable

前端 未结 2 1082
自闭症患者
自闭症患者 2020-12-15 15:28

I have IEnumerable which contains number Data inside it.

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

Attached the

相关标签:
2条回答
  • 2020-12-15 15:57

    var item = eLevelData.ElementAt(index);

    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 item = eLevelData.Cast<RMSRequestProcessor.RMSMedia>().ElementAt(index)

    0 讨论(0)
  • 2020-12-15 15:59

    Don't know much about what subset of .NET BCL/LINQ is available in Silverlight, but Skip should do the trick. But generally speaking it still uses foreach internally:

    var item = eLevelData.Skip(4 /* or 5 */).First();
    
    0 讨论(0)
提交回复
热议问题