using System; using System.Collections.Generic; using System.Linq; namespace FlowWorkEditDemo { static class CollectionHelper { public static void RemoveRange(this ICollection source, Func predicate) { var arr = source.Where(p => predicate(p)).ToArray(); foreach (var t in arr) source.Remove(t); } } }