c# - File.Copy a file created in memory -


so create file:

memorystream ms = new memorystream(); textwriter tw = new streamwriter(ms); tw.writeline("hello world!"); tw.flush(); byte[] bytes = ms.getbuffer(); 

how can use file.copy() to, well, copy file new file?

use file.writeallbytes create new file (or overwrite existing file) byte array:

file.writeallbytes(filename, bytes); 

note memorystream (what created) isn't "file", file.copy can't used.


Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -