public string Type { get; set; }
public int Qty { get; set; }
public static bool Kosher { get; set; }
public Ingredient Cheese { get; set; }
public Ingredient DeliMeat { get; set; }
Cheese = new Ingredient();
DeliMeat = new Ingredient();
public static void Print(Recipe r)
Console.WriteLine("{0}: {1} slice(s) of {2} cheese and {3} slice(s) of {4}.",
r.Name, r.Cheese.Qty, r.Cheese.Type, r.DeliMeat.Qty, r.DeliMeat.Type);
public string MakeString()
return String.Format("{0}: {1} slice(s) of {2} cheese and {3} slice(s) of {4}.",
Name, Cheese.Qty, Cheese.Type, DeliMeat.Qty, DeliMeat.Type);
public static void Main()
Recipe SimpleSandwich = new Recipe();
Recipe.Print(SimpleSandwich);
Console.WriteLine("Print Using MakeString: " + SimpleSandwich.MakeString());
Recipe MySandwich = new Recipe();
MySandwich.Name = "Esen's Favorite";
MySandwich.Cheese.Type = "Havarti";
MySandwich.Cheese.Qty = 2;
MySandwich.DeliMeat.Type = "Pastrami";
MySandwich.DeliMeat.Qty = 5;
Recipe.Print(MySandwich);