日期:2014-05-17 浏览次数:21015 次
string fileName = @"e:\2.txt";
DateTime startReadTime = DateTime.Now;
StreamReader sr = File.OpenText(fileName); //打开文件
TimeSpan costOfRead = DateTime.Now.Subtract(startReadTime);
double readFileTime = costOfRead.TotalMilliseconds;
string currentLine;
char[] sep = {' ',',','.','?','!','(',')',';',':'}; //预定义单词间的分隔符
string str;
ArrayList fileLines = new ArrayList();
DateTime startWordCount = DateTime.Now;
while ((currentLine = sr.ReadLine()) != null)
{
if (currentLine.Length == 0)
continue;
currentLine.ToLower();
fileLines.Add(currentLine);
}