【发布时间】:2013-10-31 04:08:34
【问题描述】:
任何将数据表转换为List<List<string>> 的快速方法?
我现在在做
for (int rowIndex = 1; rowIndex <= stats.EndRowIndex; rowIndex++)
{
List<string> lstOneRowElements = new List<string>();
for (int colIndex = 1; colIndex <= stats.EndColumnIndex; colIndex++)
{
lstOneRowElements.Add(excelDoc.GetCellValueAsString(rowIndex, colIndex).Trim());
}
lstAllData.Add(lstOneRowElements);
}
在哪里
private List<List<string>> lstAllData { get; set; }
有什么更好的方法可以快速完成吗?
【问题讨论】:
-
@Soner Thnaks 进行编辑
-
格式化是你的朋友
;) -
统计数据是什么类型?可能不是 .NET DataTable,因为我在该类型上没有看到 EndRowIndex 属性。是来自help.syncfusion.com/cr/cref_files/silverlight/pdf/html/…,还是什么?