如何解析本地CSV文件WP7
问题描述:
上午在开发一个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
在此先感谢
答
使用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
}
}
希望它有帮助!
重复http://stackoverflow.com/a/4681085/168097 – 2013-03-09 12:58:44
@Circadian我是新来的C#和我如何使用'streamreader'可以请你给一些istructions – sunny 2013-03-09 13:34:14