Accepted answer

apologies for the duplicate closure confusion. this question and marked answer will let you have extension method support for removing from observable collections:

removeall for observablecollections?

it won't give support for the from x in y syntax, but it will let you do:

var c = new observablecollection<selectableitem>();
c.remove(x => x.isselected);

however, with the check == and the note about your other question... if in fact you want to remove items that are in both lists, this might not be the best option.

the except extension method will produce an enumerable of items that exclude items that are in the enumerable provided as an argument, in your case the second list. this method doesn't mutate the existing enumerable, like most actions it returns a new one, so you would need to set that into a new observablecollection.


you can try this.

var toremove = homeviewmodel.recentpatients.where(x=> == pid).tolist();
foreach (var item in toremove)

Related Query