Remove content of list from another list
How do I remove the content of one list from anot开发者_开发问答her list?
list1.RemoveAll(i => list2.Contains(i));
List<object> result = anotherlist.Except(list).ToList();
Here is a short addition and advise to James post.
If you are using List<T> and the myOtherList contains many items you should convert it to a Hashset<T> var set = new Hashset(myOtherList), so his solution should run much faster.
加载中,请稍侯......
精彩评论