有什么快速的方法可以将 DataTable 转换为 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 Gönül