/// <summary> /// Discards all elements from the table. Unlike a <see cref="IHand{TElement}"/>, the table persists /// after this operation. /// </summary> /// <returns>The table (for fluent purposes).</returns> public ITable <TElement> Muck() { Deck.Events.Mucking(this); ((IDeckStackInternal <TElement>) this).CheckEnabled(); Contents.Apply(c => Deck.DiscardPileStack.Add(c)); Contents.Clear(); Deck.Events.Mucked(this); return(this); }
private bool disposedValue = false; // To detect redundant calls /// <summary> /// For a hand, this is mucking the hand. /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { Deck.Events.Mucking(this); Contents.Apply(c => Deck.DiscardPileStack.Add(c)); Contents.Clear(); HasBeenMucked = true; Deck.RemoveHand(this); Deck.Events.Mucked(this); } disposedValue = true; } }