[英]how to parse local CSV file wp7
正在開發wp7應用程序,因為我需要閱讀CSV文件並將其存儲到列表中
csv文件為20行,名字,姓氏,用逗號分隔
我試圖用http://kbcsv.codeplex.com/這一點, http://www.codeproject.com/articles/25133/linq-to-csv-library當我特林包括這些dll我得到“的windows phone項目僅適用於Windows Phone組件”錯誤
我如何解析Windows Phone 7中的csv文件
提前致謝
使用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
}
}
希望能幫助到你!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.