我们有对象:
Foo a = new Foo;
a.Prop1 = XX;
a.Prop2 = YY;
a.Prop3 = 12;
Foo b = new Foo;
b.Prop1 = XX;
b.Prop2 = ZZ;
b.Prop3 = 3;
Foo c = new Foo;
c.Prop1 = FF;
c.Prop2 = DD;
c.Prop3 = 3;
我们有一个列表 =List<Foo> MyList= new List<Foo>()
所有这些对象都添加到列表中
在遍历该列表时:
foreach(Foo _foo in Mylist)
{
// I want to get the objects whose Prop1 value is
// the same and add those to another list, what I want
// to do exactly is actually grouping based on a property.
}