Created
July 20, 2013 19:44
-
-
Save damirarh/6046195 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async Task<byte[]> ReadAsync(string filename) | |
{ | |
var fileInfo = new FileInfo(filename); | |
using (var stream = new FileStream(filename, FileMode.Open)) | |
{ | |
var buffer = new byte[fileInfo.Length]; | |
await Task<int>.Factory.FromAsync(stream.BeginRead, stream.EndRead, buffer, 0, buffer.Length, null); | |
return buffer; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment