2013-03-09 77 views
1

上午在開發一個WP7應用程序,我需要閱讀的CSV文件,並保存到列表如何解析本地CSV文件WP7

CSV文件是20日線與頭名,分隔姓氏,(逗號)

,我試圖用http://kbcsv.codeplex.com/這一點,http://www.codeproject.com/articles/25133/linq-to-csv-library當我特林包括這些dll我得到「的Windows Phone項目將與Windows Phone的組件只工作」的錯誤

如何可以解析CSV文件中的Windows Phone 7

在此先感謝

+1

重複http://stackoverflow.com/a/4681085/168097 – 2013-03-09 12:58:44

+0

@Circadian我是新來的C#和我如何使用'streamreader'可以請你給一些istructions – sunny 2013-03-09 13:34:14

回答

0

使用IsolatedStorageFileStream獲取並從保存的路徑位置打開該文件。 然後用StreamReader對象讀取。

IsolatedStorageFileStream fileStream = storage.OpenFile(filePath, FileMode.Open, FileAccess.Read); 
    using (StreamReader reader = new StreamReader(fileStream)) 
    { 
     string line; 
     while ((line = reader.ReadLine()) != null) 
     { 
     string[] temp1Arr = line.Split(','); 

     //Manipulate your string values stored in array here 
     } 
    } 

希望它有幫助!