Created
January 17, 2013 05:51
-
-
Save dend/4553993 to your computer and use it in GitHub Desktop.
Prism implementation of RemoveAll (Feb2012 release)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")] | |
public static void RemoveAll<T>(this List<T> list, Func<T, bool> filter) | |
{ | |
if (list == null) throw new ArgumentNullException("list"); | |
if (filter == null) throw new ArgumentNullException("filter"); | |
for (int i = 0; i < list.Count; i++) | |
{ | |
if (filter(list[i])) | |
{ | |
list.Remove(list[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment