locked
StreamReader does not accept path string in constructor RRS feed

  • Question

  • Hi guys

    I'm working on a Windows 8 store application, and I got some problem when I wanted to read text from a file. I tried to use the given instructions (like official reference from MSDN), but none of them solved my problem.

    This is my function:

     public void readCSV(){
       string path = @"ms-appdata:://Assets/Content/content.csv";
       try
       {
        using (StreamReader sr = new StreamReader(path)) 
        {
          /* Doing my job here... */
        }
       } 
      catch (/*...*/)
      {}
      finally
      {}
    }

    And the answer from Visual Studio 2012 is this:

    The best overloaded method match for 'System.IO.StreamReader.StreamReader(System.IO.Stream)' has some invalid arguments. Argument 1: cannot convert from 'string' to 'System.IO.Stream'


    Sunday, December 15, 2013 2:58 PM

Answers