dkilov fuss
dkilov fuss

Reputation: 97

FileIO.ReadAllBytes in Windows 8 app

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

Answers (2)

Henk Holterman
Henk Holterman

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

Related Questions