【发布时间】:2011-01-18 12:51:58
【问题描述】:
List 的对象具有如下属性:
public class PropertyDetails
{
public int Sequence { get; set; }
public int Length { get; set; }
public string Type { get; set; }
public int Index { get; set; }
}
列表将具有排序的序列。
List 的对象值如下:
序列= 1 长度=20 类型="" 索引=0
序列= 2 长度=8 类型="" 索引=0
序列= 3 长度=6 类型="" 索引=0
序列= 4 长度=20 类型="" 索引=0
序列= 5 长度=8 类型="" 索引=0
我想要 Linq 查询,它会给我结果列表为
序列= 1 长度=20Type="" 索引=20
序列= 2 长度=8 类型="" 索引=28
序列= 3 长度=6 类型="" 索引=34
序列= 4 长度=20 类型="" 索引=54
序列= 5 长度=8 类型="" 索引=62
其中 index 是考虑序列的 Length 的累积总和。
【问题讨论】: