How to Remove multiple items in List using RemoveAll on condition?

前端 未结 4 1499
清酒与你
清酒与你 2021-01-05 12:01

I tried like following.

MyList.RemoveAll(t => t.Name == \"ABS\");
MyList.RemoveAll(t => t.Name == \"XYZ\");
MyList.RemoveAll(t => t.Name == \"APO\")         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 12:55

    If it's not required at any time that there are multiple items in the list, you should consider using a HashSet instead of List

提交回复
热议问题