示例#1
0
文件: Pile.cs 项目: sm-g/SimpleCards
        public void Push(Card card, PilePosition position)
        {
            if (CardsInPile.Contains(card, CardByRefEqualityComparer.Instance))
            {
                throw new ArgumentException("Given card instance already in pile", nameof(card));
            }

            position.Push(this, card);
        }
示例#2
0
文件: Pile.cs 项目: sm-g/SimpleCards
        public void Push(IReadOnlyCollection <Card> cards, PilePosition position)
        {
            if (!cards.AllUnique(x => x, CardByRefEqualityComparer.Instance))
            {
                throw new ArgumentException("Duplicate instances in given cards", nameof(cards));
            }

            if (CardsInPile.Intersect(cards, CardByRefEqualityComparer.Instance).Any())
            {
                throw new ArgumentException("One of given cards instance already in pile", nameof(cards));
            }

            position.Push(this, cards);
        }