示例#1
0
文件: Bag.cs 项目: pokimoki99/softuni
 public void Add(Presents present)
 {
     if (Capacity > Count)
     {
         data.Add(present);
     }
 }
示例#2
0
文件: Bag.cs 项目: pokimoki99/softuni
        public Presents GetPresent(string name)
        {
            Presents currentPresent = data.FirstOrDefault(x => x.Name == name);

            return(currentPresent);
        }
示例#3
0
文件: Bag.cs 项目: pokimoki99/softuni
        public Presents GetHeaviestPresents()
        {
            Presents heaviestPresents = data.OrderByDescending(x => x.Weight).FirstOrDefault();

            return(heaviestPresents);
        }
示例#4
0
文件: Bag.cs 项目: pokimoki99/softuni
        public bool Remove(string name)
        {
            Presents present = data.FirstOrDefault(x => x.Name == name);

            return(data.Remove(present));
        }