KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've got a list of elements of a certain class. This class contains a field. class Foo {public int i;} List<Foo> list; I'd like to extract the field from all items in the list into a new list. List<int> result = list.ExtractField (e => e.i); // imaginary There are surely multiple ways to do that, but I did not find a nice-looking solution yet. I figured linq might help, but I was not sure how exactly.
Tags (comma-separated)
Save Edits
Cancel