班级:class myClass{ public int processId { get; set; } public string measurement { get; set; } public decimal measurementValue { get; set; } public string otherText { get; set; }}代码:List<myClass> myClasses = new List<myClass> { new myClass { processId=1, measurement="height", measurementValue=10,otherText="312312" }, new myClass { processId=1, measurement="length", measurementValue=11 ,otherText="312312"}, new myClass { processId=1, measurement="width", measurementValue=12 ,otherText="312312"}, new myClass { processId=2, measurement="height", measurementValue=20 ,otherText="312312"}, new myClass { processId=2, measurement="length", measurementValue=21 ,otherText="312312"}, new myClass { processId=2, measurement="width", measurementValue=22 ,otherText="312312"}};var groups = myClasses .GroupBy(o => o.processId) .ToDictionary(g => g.Select(x => x.measurement), g => g.Select(x => x.measurementValue));groups 是 Dictionary<IEnumerable<string>, Dictionary<IEnumerable<decimal>>如何为所有键和值循环分组?我没弄明白。foreach(var group in groups){ //????}
1 回答
- 1 回答
- 0 关注
- 149 浏览
添加回答
举报
0/150
提交
取消