Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# : List<string> get in between records

I am new to c#. I have a List of 100 records. I want to take between 20 to 30 index records.

Is there any easy way of getting this without for loop ??

like image 1000
Kumaresan K Avatar asked Dec 27 '25 16:12

Kumaresan K


1 Answers

Yes, You can use .Skip() and .Take() methods.

Try this code:

Records = Records.Skip(20).Take(10).ToList();

This will skip first 20 records and takes next 10 record.

like image 82
siva Avatar answered Dec 30 '25 04:12

siva