daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections.Generic;
  2.  
  3. public static class ListExtension
  4. {
  5.     public static bool Remove<T>(this List<T> list, T item, IEqualityComparer<T> compare)
  6.     {
  7.         bool hasEntry = false;
  8.         foreach (T entry in list)
  9.         {
  10.             if (!compare.Equals(item, entry))
  11.             {
  12.                 continue;
  13.             }
  14.  
  15.             hasEntry = true;
  16.             list.Remove(entry);
  17.             break;
  18.         }
  19.  
  20.         return hasEntry;
  21.     }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top