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
Post a Comment