File to MemoryStream

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

ok, I'm trying to make my aplication faster, and the main time sink seems to be in the code that is reading the file and putting it into a MemorySream.

what would be the fastest way to read a file into a MemoryStream, when the file read is done over a network?
 
Bas Hamer said:
ok, I'm trying to make my aplication faster, and the main time sink
seems to be in the code that is reading the file and putting it into
a MemorySream.

what would be the fastest way to read a file into a MemoryStream,
when the file read is done over a network?

Read in chunks (say about 32K), and write each chunk to the
MemoryStream. Don't forget to only write what you've read - use the
return value of Stream.Read to find out how much you've read.
 
Back
Top