Bruce
asked on
How do I remove a group of Items from an IList?
How do I remove all items from an IList that match a certain criteria of the type that the IList contains?
See the code...
The compiler say "Cannot resolve Symbol 'Amount'"
If I change Remove statement to this: mcl.Remove(x.Amount > 9); , it says that it cannot resolve 'x'.
Thanks!!
See the code...
The compiler say "Cannot resolve Symbol 'Amount'"
If I change Remove statement to this: mcl.Remove(x.Amount > 9); , it says that it cannot resolve 'x'.
Thanks!!
public class MyClass
{
public decimal Amount;
}
public void MyTest()
{
MyClass mc = new MyClass{Amount = 10};
IList<MyClass> mcl = new List<MyClass>();
mcl.Add(mc);
mcl.Remove(x => x.Amount > 9);
}
mcl.RemoveAll(x=> x.Amount > 9);
ASKER
I am using IList. RemoveAll isn't exposed through that interface...that I can see. (not sarcasm, I am learning this.)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got it!
Thanks for the quick response!
The points are all yours. :-)
Thanks for the quick response!
The points are all yours. :-)
thanks, good luck