readblock

StreamReader ReadBlock hangs on binary files

I've got a little class that accepts a POST from a browser that contains file uploads. I'm using a StreamReader to read it in. I read the header, then when I get to the body, I get the content length and make an array of that size and then stream.ReadBlock() on that: char[] buffer = new char[contentLength]; stream.ReadBlock(buffer, 0, ...

When to use StreamReader.ReadBlock()?

Hi, I would like to know of a situation Read(char[],int,int) fails to return all chars requested while ReadBlock() returns all chars as expected (say when StreamReader works with an instance of a FileStream object). Thanks. ...