Subtract a generic list from another

前端 未结 6 832
天涯浪人
天涯浪人 2020-12-13 23:02

I am trying remove a list of firmIDs from one list from another. I don\'t really understand linq but I am pretty sure I need to use it.

List firm         


        
6条回答
  •  没有蜡笔的小新
    2020-12-13 23:34

    The best approach would be Except() for you case. However, if the List object is different then other one, you can use All()

    firms.Where(x=> trackedFirms.All(y => y.FirmId != x.FirmId)
    

提交回复
热议问题