Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // заводим коллекцию
- var forRemoving = new ConcurrentBag<Item>();
- foreach (var item in items)
- {
- ...
- // складываем в нее элементы подлежащие удалению
- forRemoving.Add(item);
- }
- // удаляем
- foreach (var item in forRemoving)
- items.Remove(item);
- var result = items.AsParallel()
- .Where(item => condition(item))
- .ToList();
Add Comment
Please, Sign In to add comment