public DeckObservableDict <D> DiscardList(int howManyToKeep) { if (_objectList.Count != _previousNum) { throw new BasicBlankException("The list is wrong"); // } return(_objectList.Take(howManyToKeep).ToObservableDeckDict()); //try this way }
public DeckRegularDict <D> DrawSeveralCards(int howMany, bool showErrors = true) { if (_objectList.Count < howMany && showErrors) { throw new BasicBlankException("Not enough cards to draw. Needs at least " + howMany + ". There are " + _objectList.Count + " cards left"); } else if (_objectList.Count < howMany) { howMany = _objectList.Count; } DeckRegularDict <D> TempList = _objectList.Take(howMany).ToRegularDeckDict(); _objectList.RemoveGivenList(TempList, NotifyCollectionChangedAction.Remove); //try this way. so the event happens once, and not several times. TempList.MakeAllObjectsKnown(); return(TempList); }