【发布时间】:2015-05-05 11:44:38
【问题描述】:
private List<T> ReadCurrentFile(string currentExtractedFile, PurgingDetails purgingParams)
{
List<T> thinLogDoList = new List<T>();
using (StreamReader sr = new StreamReader(currentExtractedFile))
{
string currentLine = string.Empty;
Dictionary<string, string> ColumnNamesDictionary = null;
while ((currentLine = sr.ReadLine()) != null)
{
if (currentLine.IsNotNullOrEmpty() && currentLine.Contains("Æ"))
{
string[] columnNames = currentLine.Split(new char[] { 'Æ' });
ColumnNamesDictionary = FillColumnNameDictionary(columnNames);
if (CheckForValidConditions(ColumnNamesDictionary, purgingParams))
{
thinLogDoList.Add(FillThinLogDO(ColumnNamesDictionary));
}
}
}
}
return thinLogDoList;
}
(以上代码用于读取文件并通过填充对象将数据添加到列表中。)
该函数正在读取 zip 文件中大小为 10 MB 的文件,首先我提取 zip 文件,然后读取数据,使用此函数并将其存储到 List 中,然后删除提取的 zip 文件。它适用于大约 6L(6,00,000) 数据,但在该数据之上它会引发异常。
我想阅读更多数据 10L(10,00,000) 我该怎么做?
【问题讨论】:
-
如果你使用印度格式的数字会很混乱
-
正确,你真的无法做到这一点。一种方法是直接产生/返回 IEnumerable
或者甚至可能使用字典。使用字典时,我的性能得到了很大的改进,问题也更少了。 -
文件格式应该是什么?
-
文件格式是“.dat”&我已经在我的代码中使用了字典
标签: c#-4.0