using System.Collections.Generic;
Products = new List<Product>
new Product { Name = "Item 1", Price = 100.00m, Quantity = 3},
new Product { Name = "Item 2", Price = 89.00m, Quantity = 2},
new Product { Name = "Item 3", Price = 50.00m, Quantity = 1 }
foreach(var p in order.Products)
Console.WriteLine(p.Name + " (Each: " + p.Price + ")" + " - Qty: " + p.Quantity + " (" + p.Total() + ")");
public List<Product> Products { get; set; }
public string TableNumber{get;set;}
return Products.Sum(x => x.Price);
Products = new List<Product>();
public void RemoveProduct()
public bool IsAdded(string productName)
return Products.Any(x=>x.Name.ToLower() == productName.ToLower());
public string Name { get; set; }
public decimal Price { get; set; }
public int Quantity { get; set; }