linq remove item from object array where property equals value
IEnumberable
is immutable, but you can do something like this:
list = list.Where(r=>r.Year<=2000)
or write an extension method:
public static IEnumerable<T> RemoveWhere<T>(this IEnumerable<T> query, Predicate<T> predicate)
{
return query.Where(e => !predicate(e));
}
Very late to the party but for any one would comes across this problem, here is a cleaner solution:
MyList.RemoveAll( p => p.MyProperty == MyValue );