0
System.IO.StreamReader file = new System.IO.StreamReader("saveData.txt");

I've written this and I get the error "Argument 1: cannot convert from 'string' to 'System.IO.Stream'. I've used this exact same code in a console application and it worked fine, but putting this into a Windows Universal Application gives this error.

Kuang
  • 57
  • 2
  • 7

2 Answers2

1

Did you tried this?

MemoryStream memoryStream= new MemoryStream(Encoding.UTF8.GetBytes("saveData.txt"));
Kamlesh Arya
  • 4,864
  • 3
  • 21
  • 28
0

It looks like the Windows Universal Application reading file functionality is different:

var file = await ApplicationData.Current.LocalFolder.GetFileAsync("data.txt");
var lines = await FileIO.ReadLinesAsync(file);

Source : how to read a text file in windows universal app

Community
  • 1
  • 1
Chester Cobus
  • 701
  • 4
  • 12