how to take 100 records from linq query based on a condition

Viewed 10655

I have a query, which will give the result set . based on a condition I want to take the 100 records. that means . I have a variable x, if the value of x is 100 then I have to do .take(100) else I need to get the complete records.

var abc=(from st in Context.STopics 
where  st.IsActive==true && st.StudentID == 123 
select new result()
{
 name = st.name }).ToList().Take(100);
3 Answers
Related