我有以下類從通用的清單有另一個泛型列表
public class SearchResponse
{
public string SearchTerm { get; set; }
public List<DataClass> lstDataClass
public string Category { get; set; }
}
public DataClass
{
public String Date { get; set; }
public string NoOfRecord { get; set; }
}
我將通過SearchResponse
類的Searchterm
和DataClass
Date
分組是具有List<SearchResponse>
和 我想有NoOfRecord的總和獲取屬性的總和
假設
SearchResponse1
{
SearchTerm="A";
Category="cata";
ListOfDataClass
{
dataclass
{
5 may 2013,
50
}
dataclass
{
6 may 2013,
68
}
}
}
SearchResponse2
{
SearchTerm="A";
Category="catb";
ListOfDataClass
{
dataclass
{
5 may 2013,
52
}
dataclass
{
6 may 2013,
63
}
}
}
SearchResponse3
{
SearchTerm="B";
Category="catc";
ListOfDataClass
{
dataclass
{
5 may 2013,
48
}
dataclass
{
6 may 2013,
21
}
}
}
我想
SearchTerm="A", Date=5 May 2013, TotalRecords=102
SearchTerm="A", Date=6 May 2013, TotalRecords=131
SearchTerm="B", Date=6 May 2013, TotalRecords=48
.
.
.