public override string ToString() { var sb = new StringBuilder(); foreach (var p in Orders.Last().Pizzas) { sb.AppendLine(p.Name); } { // \n{sb.ToString()} } return($"--- From Store:{SelectedStore.Name} ----- \nPizzas:{Orders.Last().Pizzas.Count}\nTotal: ${Orders.Last().Total}"); }
public override string ToString() { var sb = new StringBuilder(); foreach (var p in Orders.Last().Pizzas) { sb.AppendLine(p.ToString()); } // $ means you can take any properties of fields of that object and get the string value of them return($"you have selected this store: {SelectedStore} and ordered these pizzas: { sb.ToString() }"); // called string interpolation //return $"I have selected this store: {SelectedStore}"; // called string concatenation }