using System.Collections.Generic;
public string Name { get; set; }
public int Number { get; set; }
public IList<LineItem> Items { get; set; }
public override string ToString()
return string.Format("Name: {0}, Number: {1}, Line Items: [{2}]", Name, Number, string.Join("|", Items.Select(i => string.Format("Name: {0}, Qty: {1}, Price: {2}", i.Name, i.Quantity, i.Price))));
public string Name { get; set; }
public int Quantity { get; set; }
public decimal Price { get; set; }
public static void Main()
new LineItem { Name = "Item 1", Quantity = 10, Price = 12.34m },
new LineItem { Name = "Item 2", Quantity = 20, Price = 56.78m }
Console.WriteLine(order);