1

CSVファイルを読み取ってリストに保存する必要があるwp7アプリケーションを開発しています

csv ファイルは 20 行で、名と姓が ,(カンマ) で区切られています

そして、私はhttp://kbcsv.codeplex.com/ this とhttp://www.codeproject.com/articles/25133/linq-to-csv-libraryを使用しようとしましたが、これらの dll を含めようとすると、 「windows phone」プロジェクトは Windows Phone アセンブリでのみ機能します」というエラー

Windows Phone 7でcsvファイルを解析するにはどうすればよいですか

前もって感謝します

4

1 に答える 1

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 
      }
    }

それが役に立てば幸い!

于 2013-03-10T08:52:26.003 に答える