Reputation: 97
I'm trying to use FileIO.ReadAllBytes
and File.ReadAllBytes
in my Win 8 app but there is an error:
'Windows.Storage.FileIO' does not contain a definition for 'ReadAllBytes'
My code:
byte[] bytes = FileIO.ReadAllBytes(@"image.png");
string encoded = Convert.ToBase64String(bytes);
string content = "file1=" + encoded + "";
Upvotes: 1
Views: 754
Reputation: 273179
There simply is no such method. And that figures, the FileIO class does not support synchronous methods.
The closest match is ReadBufferAsync. Look at the sample and note the await
in the call.
Upvotes: 3
Reputation: 1923
There is no such method in this namespace http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.fileio.aspx have a look here http://msdn.microsoft.com/en-us/library/windows/apps/hh758325.aspx
Upvotes: 0