LINQ: how to remove items that match certain conditions? recursively??

  • Thread starter Thread starter Jessica Alba
  • Start date Start date
J

Jessica Alba

Guest
i have a List<MyObj> that contains a List<MyObj> and a list of string.

I want to get new list of List<MyObj> which removes those string contains "ABC".

So if I have this:

List<1>---List<2>+string1+string2+string3

List<2>--string4+string5

probably in the end I will get

List<1>---List<2>+string2+string3

List<2>---string5

because those strings match the condition have been removed. i guess i have to something like this:



private List<MyObj> GetLists(List<MyObj> list)
{
var temp = select x from myList
if x is type of List<MyObj> then GetList<x>

else if (x contains "ABC")
list.Remove(x)
}


Please help. Thanks

Jessi

1 + 1 = 3

Continue reading...
 
Back
Top