可能措辞不太正确,但这就是我所拥有的,这是我想要达到的结果:
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"}});
我想按成分对蛋糕进行分组。所以我想结束这个:
- Sugar
Cake1
Cake2
- Stevia
Cake3
- Chocolate
Cake1
- Butter
Cake2
Cake3
提前致谢!