Create new list from a old list using a lambda function

c#, lambda, list

Solution

You could use LINQ (a conjunction of the `.Where()` and .ToList() extension methods):

List<InputRow> originalList = ...
List<InputRow> filteredList = originalList
    .Where(x => x.someProperty > 1)
    .ToList();

Problem

I have the following: `List<InputRow>` which contains a number of InputRow objects. I am wondering if there is a way for me to use a lambda function on my original list to give me a new List where `InputRow.someProperty > 1` for all the objects. This would leave me with a list of InputRow objects all having someProperty greater than 1.

Original source

Related problems