【发布时间】:2017-11-22 22:15:11
【问题描述】:
我有以下课程:
public class AuditBatch
{
public List<string> Tables { get; set; }
public List<long> TotalRecords { get; set; }
public List<int> Index { get; set; }
然后由另一个类调用,并将值添加到这些列表中:
auditBatch.Tables.Add(extractQuery.Category);
auditBatch.TotalRecords.Add(rowsInFile + totalRowsInFile);
auditBatch.Index.Add(fileIndex);
然后我希望能够将这些列表添加到一个列表中,该列表将这些列表中的每一个作为一列,因此它看起来像这样:
Tables | TotalRecords | FieldIndex
John 333 1
Paul 200 4
Ringo 890 1
以后我可能有兴趣按 FieldIndex 分组并获取最高的 TotalRecords 行。
我遵循了很多示例,但似乎找不到任何有效的方法。
【问题讨论】:
-
删除属性上的
List<T>并将它们更改为各自的类型。然后你会有List<AuditBatch> -
我将如何填充列表?