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. an other 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).
If anyone knows any better way or simpler i'd be happy and grateful :P other wise i'll do it with the reading in smaller chunks. Ty for any help.