Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- public static class ListExtension
- {
- public static bool Remove<T>(this List<T> list, T item, IEqualityComparer<T> compare)
- {
- bool hasEntry = false;
- foreach (T entry in list)
- {
- if (!compare.Equals(item, entry))
- {
- continue;
- }
- hasEntry = true;
- list.Remove(entry);
- break;
- }
- return hasEntry;
- }
- }
Add Comment
Please, Sign In to add comment