作者heliosy (这一栏是要做啥用的)
看板C_Sharp
标题[问题] 读档
时间Wed May 5 21:00:48 2004
我想读txt的档案
内容格式大概是
oooo ------------->总笔数
xxx xxx xxx -
xxx xxx xxx |
.. |
.. |
.. |→大概上万笔吧
.. |
.. |
.. |
.. |
xxx xxx xxx -
以下是程式片段
string path = this.openFileDialog1.FileName;
FileInfo fileInfo1 = new FileInfo(path);
FileStream fs = fileInfo1.Open(FileMode.Open);
StreamReader sr = new StreamReader(fs,System.Text.Encoding.Default);
if(fs.Length>0)
{
bool temp = true;
do
{
if(temp==true)
{
string a = sr.ReadLine();
spot = a.Split();
temp=false;
}
openfile+=sr.ReadLine()+" ";
}while(sr.Peek()!=-1);
}
split = openfile.Split();
这样是读的进来
但是跑个上万行的资料的话
读的时间就满久的
请问一下有什麽方法可以让效能快一点呢
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.115.220.18
1F:→ flydrago:Multi-thread 推140.114.221.148 05/06