We can set the buffersize
for Reading a File in FileStream
itself.
FileStream fs=new FileStream(path,FileMode,FileAccess,FileShare,1024);
^
So why would we need BufferedStream
if we can set buffer size in FileStream
itself.
Thanks
So why would we need BufferedStream if we can set buffer size in FileStream itself.
Because not every stream is a FileStream
. What about NetworkStream
? Or some other arbitrary stream? Or a situation where the code that needs buffering isn't the code that creates the stream? Being able to effectively add buffering post-construction can be very handy for writing general purpose code to work with any stream.
See more on this question at Stackoverflow