Based on the answer found Here, you could probably use the same helper methods:
public static List<List<T>> CombinationsOf<T>(List<List<T>> sets)
{
var combinations = new List<List<T>>();
foreach (var value in sets[0])
combinations.Add(new List<T> { value });
foreach (var set in sets.Skip(1))
combinations = AddSet(combinations, set);
return combinations;
}
private static List<List<T>> AddSet<T>(List<List<T>> combinations, List<T> set)
{
var result = from value in set
from combination in combinations
select new List<T>(combination) { value };
return result.ToList();
}
Usage Example (based on OP's example)
...
var foods = recipes.SelectMany(recipe =>
recipe.IngredientGroups.Select(ingredient =>
ingredient.Ingredients.Select(o => o.Name).ToList()));
var results = from combination in CombinationsOf(foods.ToList())
select string.Join(", ", combination);
...
Output
results :=
Food8, Food5, Food3
Food9, Food5, Food3
Food8, Food10, Food3
Food9, Food10, Food3
Food8, Food11, Food3
Food9, Food11, Food3
Food8, Food5, Food4
Food9, Food5, Food4
Food8, Food10, Food4
Food9, Food10, Food4
Food8, Food11, Food4
Food9, Food11, Food4