Supermarket.Inventory.CalculateTotal C# (CSharp) Method

CalculateTotal() private method

Calculates the total cost of all items in this inventory. TotalCost is equal to the sum of (quantity * price) for all products.
private CalculateTotal ( ) : void
return void
        private void CalculateTotal()
        {
            totalCost = 0;
            foreach (Product product in items.Values)
            {
                // Sum of (quantity * price) for all products.
                totalCost += (product.Price * product.Quantity);
            }
        }