看板 C_Sharp 關於我們 聯絡資訊
我想讀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
flydrago:Multi-thread 推140.114.221.148 05/06