Remove instances from a list by using LINQ or Lambda?

前端 未结 7 1580
囚心锁ツ
囚心锁ツ 2021-02-05 03:26

Now I come a stage to get all my data as a list in cache(objects) and my next thing I have to do is to remove some instances from the list.

Normally, I would do removing

7条回答
  •  无人及你
    2021-02-05 03:52

    You could use the method RemoveAll:

    MyClass one; //initialize MyClass
    list.RemoveAll(item => one.Value1 == item.Value1 && one.Value2 < item.Value2);
    

提交回复
热议问题