1

I have an collection of iQueryable objects. Looking through intellisense i see 'GetElementAt(int)' but what i actually want to do is return multiple elements - so something like GetElementAt(int startindex, int count) GetElementAt(int startindex, int endIndex).

I cant seem to see this. Any ideas?

The only other thing i can think of is to iterate for the number of items i want using GetElementAt() each time e.g.

for (int i = 20;i<40;i++)
   PrintName(MyList.GetElementAt(i));

Which seems to defeat the point abit.

maxp
  • 24,209
  • 39
  • 123
  • 201
  • Here is the same question: http://stackoverflow.com/questions/1287340/net-equivalent-of-javas-list-sublist/1287409#1287409 – Kamarey Aug 17 '09 at 12:46

1 Answers1

6

Sounds like:

myList.Skip(startIndex).Take(count);
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194