Take the 2-minute tour ×

I have an IEnumerable of Lesson objects:

IEnumerable<Lesson> filteredLessons

I convert it to a List through the following method:


But I want the returned list to contain only the first property, lessonid, not all the Lesson properties.

How can I get the data of specific property of the list instead of the objects?

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

You can select the value you want first, like this:

filteredLessons.Select(l => l.lessonId).ToList();

And you'll get a list of ID's

share|improve this answer
Thanks a lot .... –  just_name Dec 21 '11 at 11:09
add comment

Your Answer


