public Bag <T> excluding(T element) { var copy = new Bag <T>(this); copy.remove(element); return(copy); }
public Bag <T> excluding(T element) { var copy = new Bag <T>(this); //copy.RemoveAll(item => item == null); //int count = copy.Where(s => s != null && s.Equals(element)).Count(); //for (int i = 0; i < count; i++) //{ // copy.remove(element); //} copy.remove(element); return(copy); }