Using LINQ to remove elements from a List<T>
Say that I have LINQ query such as:
var authors = from x in authorsList
where x.firstname == "Bob"
select x;
Given that authorsList
is of type List<Author>
, how can I delete the Author
elements from authorsList
that are returned by the query into authors
?
Or, put another way, how can I delete all of the firstname's equalling Bob from authorsList
?
Note: This is a simplified example for the purposes of the question.