110,566
社区成员
发帖
与我相关
我的任务
分享
while(Jps.Count()>0)
IEnumerable<IGrouping<string,JPropertyInfo>> Jps=
Propertys.SelectMany(u => u.Propertyies.Where(w => w.Index == n))
.GroupBy(p=>p.Property.Path);//只查询到一个结果,即Count=1
IGrouping<string, JPropertyInfo> Jpropertys = Jps.ElementAt(0);
foreach(JPropertyInfo jp in Jpropertys )
{
//Dosomething
}
List<IGrouping<string, JPropertyInfo>> listp = Jps.ToList();
listp.RemoveAll(u => u == Jps.ElementAt(0));
Jps=listp.AsEnumerable();
IEnumerable<IGrouping<string,JPropertyInfo>> Jps=
Propertys.SelectMany(u => u.Propertyies.Where(w => w.Index == n))
.GroupBy(p=>p.Property.Path);//只查询到一个结果,即Count=1
while(Jps.Count()>0)
{
IGrouping<string, JPropertyInfo> Jpropertys = Jps.ElementAt(0);
foreach(JPropertyInfo jp in Jpropertys )
{
//Dosomething
}
List<IGrouping<string, JPropertyInfo>> listp = Jps.ToList();
listp.RemoveAll(u => u == Jps.ElementAt(0));
Jps=listp.AsEnumerable();
}
按照我的想法来说,应该while循环只循环一次才对啊,为什么循环了两次,第二次才u == Jps.ElementAt(0)为true,才给删除掉,第一次RemoveAll里的判断为false。