Say that I have LINQ query such as:
var authors = from x in authorsList
where x.firstname == "Bob"
authorsList is of type
List, how can I delete the
Author elements from
authorsList that are returned by the query into
Or, put another way, how can I delete all of the firstname’s equalling Bob from
Note: This is a simplified example for the purposes of the question.
Actually, it is a closer duplicate of:
RemoveAll for ObservableCollections?
using LINQ to remove objects within a List
This is the code I’m using, but its not very readable. Can I use LINQ to shorten the code below while still having the same functionality?
int index = 0;
int pos = 0;
foreach (var x in HomeViewModel.RecentPatients)
if (x.PID == p.PID)
pos = index;
君不见黄河之水天上来，奔流到海不复回。 君不见高堂明镜悲白发，朝如青丝暮成雪。 人生得意须尽欢，莫 … 继续阅读将进酒