public static void GetReceipe(Object recette) { Recette receipe = (Recette)recette; //Explode the steps from the receipe in an array string[] steps = Regex.Split(receipe.liste_etapes_recette, ";"); //Foreach step in the steps array foreach (var step in steps) { int stepId = Convert.ToInt32(step); //From BDD we get all objects needed composé actualCompose = BDDController.Instance.DB.composé.SingleOrDefault(c => c.id_compose == stepId); Etape actualStep = BDDController.Instance.DB.Etape.SingleOrDefault(e => e.id_etape == actualCompose.id_etape); Console.WriteLine(actualCompose.id_Ingredient); Ustensile ustensile = BDDController.Instance.DB.Ustensile.SingleOrDefault(e => e.id_Ustensile == actualStep.id_Ustensile); LoggerController.AppendLineToFile(Parameters.LOG_PATH, actualCompose.id_etape.ToString()); //Foreach steps in the receipe we create a new thread. Thread t = new Thread(delegate() { //We use the method ass call back function of the thread. //Two arg sent : step and ustensile object CookCallback(actualStep, ustensile); }); //Start the thread t.Start(); } }