It cannot be formulated absolutely correctly, but here is what I have and here is the result that I want to achieve:
class Cake
{
public List<string> Ingrediants {get;set;}
public DateTime Baked {get;set;}
public string CakeName {get;set;}
}
List<Cake> cakes= new List<Cake>();
cakes.Add(new Cake() {CakeName = "Cake1", Ingrediants = new List<string>() {"Sugar", "Chocolate"}});
cakes.Add(new Cake() {CakeName = "Cake2", Ingrediants = new List<string>() {"Sugar", "Butter"}});
cakes.Add(new Cake() {CakeName = "Cake3", Ingrediants = new List<string>() {"Stevia", "Butter"}});
I would like to group pies using ingredients. Therefore, I would like to get the following:
- Sugar
Cake1
Cake2
- Stevia
Cake3
- Chocolate
Cake1
- Butter
Cake2
Cake3
Thanks in advance!
source
share