I need a method that reads a file to a byte array asynchronously but I don't know what size the file will be (it can be a few Kb of a good few Mb).
I've tried FileStream to get the length and use BeginRead, but the problem is length is a long and BeginRead only accepts int, if the file is to big it'll probably overflow. Another way I was thinking was read it by smaller chunks but every time I have to read a new chunk of bytes I'll have to create a new array (just wanted to avoid having to initialize new and bigger arrays).
I am open to better or simpler ways, otherwise I'll do it with the reading in smaller chunks.