Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have IEnumerable which contains number Data inside it.

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

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

alt text http://www.freeimagehosting.net/uploads/bd72c6c310.jpg

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

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.

Thanks,

Subhen

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
229 views
Welcome To Ask or Share your Answers For Others

1 Answer

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...