wcf - asp.net Concatenate files -


in program, split file multiple files , sent wcf rest service joins 1 file. after concatenate, file size more size of file sent.

following code concatenate:

        string[] files = directory.getfiles(path, string.concat(guid, "*"),searchoption.topdirectoryonly);         streamreader filereader;         streamwriter filewriter = new streamwriter(path + newguid);         (int64 count = 0; count < files.length; count++)         {             filereader = new streamreader(string.concat(path,guid, count));             filewriter.write(filereader.readtoend());         }         filewriter.close(); 

are dealing text files because both streamwriter , streamreader meant used text files , not binary files.

further, line filewriter.write(filereader.); appears wrong. should like

filewriter.write(filereader.readtoend()); 

of course, if file size large, should doing reading/writing in chunks or line line basis.


Comments