LINQ: How to remove element from IQueryable<T>

Posted by aximili on Stack Overflow See other posts from Stack Overflow or by aximili
Published on 2010-05-30T04:24:50Z Indexed on 2010/05/30 12:12 UTC
Read the original article Hit count: 799

Filed under:
|
|

How do you loop through IQueryable and remove some elements I don't need.

I am looking for something like this

var items = MyDataContext.Items.Where(x => x.Container.ID == myContainerId);
foreach(Item item in items)
{
  if(IsNotWhatINeed(item))
    items.Remove(item); 
}

Is it possible? Thanks in advance

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ