Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Reading File From PCL

$
0
0

Hi,

I am using PCL's and I want to read a json file from the shared project. This is my code

    String json = "";
        using (StreamReader sr = new StreamReader("data.json"))
        {
            json = sr.ReadToEnd();
        }

but it doesn't work because in PCL StreamReader can't accept a String as an argument, so new StreamReader("data.json") is wrong.
So how can I read the file and convert it to a string?


Viewing all articles
Browse latest Browse all 58056

Trending Articles