using System.Collections.Generic;
public struct Ingredient {
public Ingredient(string pName, double pAmount, string pUnit) {
private List<Ingredient> ingredients = new List<Ingredient>();
public Ingredient[] Ingredients {
return ingredients.ToArray();
public void AddIngredient(Ingredient ing) {
public static void Main()
Ingredient sugar= new Ingredient("sugar",2,"teaspoon");
Ingredient orangepeel = new Ingredient("orange peel",1,"handful");
Recipe recipe1= new Recipe();
recipe1.AddIngredient(sugar);
recipe1.AddIngredient(orangepeel);
foreach(var item in recipe1.Ingredients)
Console.WriteLine(item.name);
Console.WriteLine(item.amount);
Console.WriteLine(item.unit);