Esempio n. 1
0
        public virtual void RemoveMember(Player player)
        {
            if (! IsPlayerAlreadyInTeam(player)) throw new InvalidOperationException("Player not in team!");

            if (player.Equals(TwelfthMan))
            {
                twelfthMan = null;
            }
            else
            {
                members.Remove(player);
            }
        }
Esempio n. 2
0
 public virtual bool IsPlayerAlreadyInTeam(Player player)
 {
     // notice I can use Contains() and Equals() instead of digging down to ID's.
     // this also works for value objects. Implement Equals()!
     return members.Contains(player) || player.Equals(TwelfthMan);
 }