Supermarket.Inventory.Quantity C# (CSharp) 메소드

Quantity() 공개 메소드

Checks the quantity of a product by the given name.
public Quantity ( string product ) : int
product string The name of the product to check the quantity of.
리턴 int
        public int Quantity(string product)
        {
            // If the inventory contains the product: return it's quantity
            if (Contains(product))
            {
                return items[product].Quantity;
            }
            // Otherwise quantity is 0
            else
            {
                return 0;
            }
        }