diff --git a/src/BizHawk.Common/Extensions/CollectionExtensions.cs b/src/BizHawk.Common/Extensions/CollectionExtensions.cs index a451e199fa..4d6a6891cb 100644 --- a/src/BizHawk.Common/Extensions/CollectionExtensions.cs +++ b/src/BizHawk.Common/Extensions/CollectionExtensions.cs @@ -233,9 +233,9 @@ namespace BizHawk.Common.CollectionExtensions /// (This is an extension method which reimplements for other collections. /// It defers to the existing RemoveAll if the receiver's type is or a subclass.) /// - public static int RemoveAll(this ICollection list, Predicate match) + public static int RemoveAll(this ICollection list, Func match) { - if (list is List listImpl) return listImpl.RemoveAll(match); + if (list is List listImpl) return listImpl.RemoveAll(item => match(item)); // can't simply cast to Predicate, but thankfully we only need to allocate 1 extra delegate var c = list.Count; if (list is IList iList) { @@ -246,7 +246,7 @@ namespace BizHawk.Common.CollectionExtensions } else { - foreach (var item in list.Where(item => match(item)) // can't simply cast to Func + foreach (var item in list.Where(match) .ToArray()) // very important { list.Remove(item);