コード例 #1
0
        public Merchendise GetMerchendise(string itemId)
        {
            Merchendise retMerch = null;

            foreach (var merch in merchendiseList)
            {
                if (merch.ItemId == itemId)
                {
                    retMerch = merch;
                }
            }
            return(retMerch);
        }
コード例 #2
0
 public static double GetValueOfMerchendise(Merchendise merchendise)
 {
     if (merchendise is Book book)
     {
         Book b = (Book)merchendise;
         return(GetValueOfBook(book));
     }
     if (merchendise is Amulet amulet)
     {
         Amulet a = (Amulet)merchendise;
         return(GetValueOfAmulet(amulet));
     }
     else
     {
         return(0.0);
     }
 }
コード例 #3
0
 public void AddMerchandise(Merchendise merch)
 {
     merchendiseList.Add(merch);
 }