コード例 #1
0
        public Egg GetStrongestEgg()
        {
            Egg strongestEgg = this.data
                               .OrderByDescending(x => x.Strength)
                               .FirstOrDefault();

            return(strongestEgg);
        }
コード例 #2
0
        public Egg GetEgg(string color)
        {
            Egg egg = this.data
                      .OrderByDescending(x => x.Color == color)
                      .FirstOrDefault();

            return(egg);
        }
コード例 #3
0
        public bool RemoveEgg(string color)
        {
            if (this.data.Any(x => x.Color == color))
            {
                Egg eggToRemove = this.data
                                  .Where(x => x.Color == color)
                                  .FirstOrDefault();

                this.data.Remove(eggToRemove);
                return(true);
            }
            return(false);
        }